-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathbuild_app_win.py
More file actions
55 lines (48 loc) · 1.46 KB
/
Copy pathbuild_app_win.py
File metadata and controls
55 lines (48 loc) · 1.46 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
import subprocess
import sys
import os
import shutil
def main():
print("Building AQW Bot Windows standalone executable...")
app_name = "AQW_Bot"
entrypoint = "gui.py"
# Clean output directories if they exist
for path in [
os.path.join("build", app_name),
os.path.join("dist", f"{app_name}.exe")
]:
if os.path.exists(path):
try:
if os.path.isdir(path):
shutil.rmtree(path)
else:
os.remove(path)
print(f"Cleaned existing {path}.")
except Exception as e:
print(f"Warning: Could not clean {path}: {e}")
# Build command for PyInstaller on Windows
cmd = [
sys.executable,
"-m",
"PyInstaller",
"--name=" + app_name,
"--onefile",
"--noconsole",
"--noconfirm",
"--clean",
"--add-data=web;web",
"--icon=app.ico",
entrypoint
]
print("Executing command: " + " ".join(cmd))
result = subprocess.run(cmd)
if result.returncode == 0:
print("\n" + "="*50)
print("SUCCESS! Windows standalone executable built successfully.")
print(f"You can find the standalone exe at: {os.path.abspath(f'dist/{app_name}.exe')}")
print("="*50 + "\n")
else:
print("\nERROR! PyInstaller build failed.")
sys.exit(result.returncode)
if __name__ == "__main__":
main()