-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.py
37 lines (29 loc) · 945 Bytes
/
build.py
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
import shutil
import os
from PyInstaller.__main__ import run
def compile(name, source, **additional):
print(f"Compiling {source} as {name}.exe")
config = [
"--distpath=./build",
"--workpath=./build_temp",
"--specpath=./build",
f"--name={name}",
"--onefile",
source
]
for k, v in additional.items():
if v is True:
config.insert(-2, "--" + k.replace("_", "-"))
else:
config.insert(0, f"--{k.replace('_', '-')}={v}")
run(config)
compile("game", "src/__main__.py", windowed=True)
compile("QuaTrythm_Launcher", "src/launcher.py")
if os.path.exists("build/charts/"):
shutil.rmtree("build/charts/")
if os.path.exists("build/assets/"):
shutil.rmtree("build/assets/")
if os.path.exists("build/user/"):
shutil.rmtree("build/user/")
shutil.copytree("src/charts/", "build/charts/")
shutil.copytree("src/assets/", "build/assets/")