-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsetup.py
More file actions
54 lines (48 loc) · 1.33 KB
/
Copy pathsetup.py
File metadata and controls
54 lines (48 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import os
import os.path as path
import shutil
import sys
import subprocess
import PyInstaller.__main__ as pyinst_main
from amanda.config import LIB_AMA
OS_X = sys.platform == "darwin"
WIN_32 = sys.platform == "win32"
LINUX = sys.platform == "linux"
def main():
bin_name = "amanda"
script = path.abspath(path.join("./amanda", "__main__.py"))
build_dir = "./dist"
try:
# Run tests
subprocess.run([sys.executable, "-m", "tests.test"], check=True)
# Compile VM
os.environ["PYINST_BUILD"] = "1"
subprocess.run(
[sys.executable, "-m", "utils.build", "--release"], check=True
)
except Exception as e:
print("Error during setup: ")
print(e.output)
sys.exit(1)
path_sep = os.pathsep
# Build the things
pyinst_main.run(
[
f"--name={bin_name}",
"--onefile",
"--console",
"--clean",
"--noconfirm",
# Builtin modules
f"--add-data=./std/embutidos.ama{path_sep}./std/",
# VM dynamic lib
f"--add-data={LIB_AMA}{path_sep}./deps/",
f"--distpath={build_dir}",
f"{script}",
]
)
# Remove build files
os.remove(f"{bin_name}.spec")
shutil.rmtree("./build")
if __name__ == "__main__":
main()