-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
69 lines (57 loc) · 1.77 KB
/
build.py
File metadata and controls
69 lines (57 loc) · 1.77 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
58
59
60
61
62
63
64
65
66
67
68
69
"""
PyInstaller build script for TF2 Queue Timer.
Usage: python build.py
Creates: dist/TF2QueueTimer/
- TF2QueueTimer.exe
- font.ttf, icon.ico
- _internal/ <- Dependencies hidden here
"""
import subprocess
import sys
from pathlib import Path
def main():
print("Building TF2 Queue Timer with PyInstaller...")
print("=" * 55)
try:
import PyInstaller
except ImportError:
print("PyInstaller not found. Installing...")
subprocess.run([sys.executable, "-m", "pip", "install", "pyinstaller"], check=True)
assets = ["icon.ico", "font.ttf"]
for asset in assets:
if not Path(asset).exists():
print(f"ERROR: {asset} not found!")
sys.exit(1)
data_sep = ";" if sys.platform.startswith("win") else ":"
cmd = [
sys.executable, "-m", "PyInstaller",
"--name", "TF2QueueTimer",
"--windowed",
"--icon", "icon.ico",
"--add-data", f"icon.ico{data_sep}.",
"--add-data", f"font.ttf{data_sep}.",
"--noconfirm",
"--clean",
"main.py",
]
print("Running PyInstaller...")
result = subprocess.run(cmd)
if result.returncode != 0:
print("\nBuild failed!")
sys.exit(1)
print()
print("=" * 55)
print("Build complete!")
print()
print("Output: dist/TF2QueueTimer/")
if sys.platform.startswith("win"):
print(" ├── TF2QueueTimer.exe")
else:
print(" ├── TF2QueueTimer")
print(" ├── font.ttf, icon.ico")
print(" ├── settings.json (created on first run)")
print(" └── _internal/ (dependencies)")
print()
print("Zip and distribute the TF2QueueTimer folder.")
if __name__ == "__main__":
main()