-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
46 lines (31 loc) · 1.05 KB
/
build.py
File metadata and controls
46 lines (31 loc) · 1.05 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
#!/usr/bin/env python3
import os
import sys
import shutil
import subprocess
def build(windowed: bool = False) -> None:
mode = "windowed" if windowed else "console"
print(f"Building with {mode} mode")
for path in ["build", "dist"]:
if os.path.exists(path):
shutil.rmtree(path)
icon_path = "divaautobackup/assets/logo.ico"
cmd = [
sys.executable, "-m", "PyInstaller",
"DivaAutoBackup.spec"
]
try:
subprocess.run(cmd, check=True)
print("Build successful")
print("Copying external files")
shutil.copy2("config.yml", "dist/config.yml")
log_path = "dist/dab2.log"
if not os.path.exists(log_path):
with open(log_path, "w") as f:
f.write("")
print("Build complete! Dist folder ready for distribution")
except subprocess.CalledProcessError as e:
print(f"Build failed: {e}")
sys.exit(1)
if __name__ == "__main__":
build(windowed=False)