project restructure with Rust workspaces
This commit is contained in:
parent
1f03a44f33
commit
6e585dd37d
428 changed files with 19372 additions and 6061 deletions
65
post_build.py
Normal file
65
post_build.py
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
# Simple python script used to
|
||||
# copy some libraries to the "target" directory
|
||||
# after Rust build
|
||||
|
||||
# Note that Rust build should be run via "cargo make <cmd>" command
|
||||
# in order to automate all the compile process
|
||||
|
||||
import os
|
||||
from pathlib import Path
|
||||
import shutil
|
||||
|
||||
# some config vars
|
||||
SOURCE = (
|
||||
"resources/commands/",
|
||||
"resources/vosk/",
|
||||
"resources/lib/",
|
||||
"resources/keywords/",
|
||||
"resources/rustpotter/",
|
||||
"resources/sound/",
|
||||
"lib/windows/amd64/libgcc_s_seh-1.dll",
|
||||
"lib/windows/amd64/libstdc++-6.dll",
|
||||
"lib/windows/amd64/libvosk.dll",
|
||||
"lib/windows/amd64/libvosk.lib",
|
||||
"lib/windows/amd64/libwinpthread-1.dll"
|
||||
)
|
||||
|
||||
TARGET_DIRS = (
|
||||
"target/debug",
|
||||
"target/release"
|
||||
)
|
||||
|
||||
ABS_PATH = os.getcwd() + "/"
|
||||
|
||||
for tdir in TARGET_DIRS:
|
||||
tdir = ABS_PATH + tdir
|
||||
|
||||
if not Path(tdir).is_dir():
|
||||
print("Skipping target, not a directory: ", tdir)
|
||||
continue
|
||||
|
||||
# copy lib files
|
||||
for src in SOURCE:
|
||||
if os.path.isdir(ABS_PATH + src):
|
||||
# copy the whole directory
|
||||
full_target_dir_path = os.path.join(tdir, src)
|
||||
|
||||
if os.path.isdir(full_target_dir_path):
|
||||
print("[-] Directory already exists, skipping: ", src)
|
||||
else:
|
||||
shutil.copytree(ABS_PATH + src, os.path.join(tdir, src))
|
||||
|
||||
print("[+] Directory copied: ", src)
|
||||
elif os.path.isfile(ABS_PATH + src):
|
||||
# copy file
|
||||
full_target_file_path = os.path.join(tdir, src)
|
||||
if os.path.isfile(full_target_file_path):
|
||||
print("[-] File already exists, skipping: ", src)
|
||||
else:
|
||||
shutil.copy(ABS_PATH + src, tdir)
|
||||
print("[+] File copied: ", src)
|
||||
else:
|
||||
print("[?] Unknown entity to copy: ", src)
|
||||
|
||||
|
||||
print("Post compile build done.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue