-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
57 lines (47 loc) · 1.22 KB
/
Copy pathbuild.py
File metadata and controls
57 lines (47 loc) · 1.22 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
55
56
57
#!/usr/bin/env python3
"""Build a standalone executable from gui.py using PyInstaller."""
import os
import platform
import shutil
import subprocess
import sys
from pathlib import Path
def get_separator() -> str:
return ";" if platform.system() == "Windows" else ":"
def main() -> int:
sep = get_separator()
work_dir = Path("build").resolve()
dist_dir = Path("dist").resolve()
# Clean previous build artifacts so the test is deterministic.
if work_dir.exists():
shutil.rmtree(work_dir)
if dist_dir.exists():
shutil.rmtree(dist_dir)
args = [
sys.executable,
"-m",
"PyInstaller",
"--onefile",
"--noconsole",
"--name",
"TVVideoChapterTool",
"--collect-data",
"customtkinter",
"--hidden-import",
"customtkinter",
"--hidden-import",
"PIL.Image",
"--hidden-import",
"yaml",
"--add-data",
f"config.yaml{sep}.",
"--add-data",
f"README.md{sep}.",
"--clean",
"gui.py",
]
print("Running:", " ".join(args))
result = subprocess.run(args, check=False)
return result.returncode
if __name__ == "__main__":
sys.exit(main())