-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
53 lines (47 loc) · 1.45 KB
/
build.py
File metadata and controls
53 lines (47 loc) · 1.45 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
"""
build.py — Build PythonEscapeRoom for macOS, Windows, or Linux.
Run with: uv run build.py
"""
import subprocess
import sys
args = [
sys.executable, "-m", "PyInstaller",
"--onedir",
"--name", "PythonEscapeRoom",
"--add-data", "rooms:rooms",
]
if sys.platform == "darwin":
args += ["--windowed", "--osx-bundle-identifier", "com.kurt.pythonescaperoom"]
dist_path = "dist/PythonEscapeRoom.app"
tip = "Drag it to Applications or double-click to play."
elif sys.platform == "win32":
args += ["--windowed"]
dist_path = "dist\\PythonEscapeRoom\\PythonEscapeRoom.exe"
tip = "Double-click the .exe to play."
else:
dist_path = "dist/PythonEscapeRoom/PythonEscapeRoom"
tip = "Run the executable directly."
args.append("app.py")
subprocess.run(args, check=True)
if sys.platform == "darwin":
# Ad-hoc sign so Gatekeeper doesn't block it
subprocess.run(
["codesign", "--force", "--deep", "--sign", "-", dist_path],
check=True,
)
# Use ditto instead of zip — preserves symlinks and macOS metadata
zip_path = "dist/PythonEscapeRoom.zip"
subprocess.run(
["ditto", "-c", "-k", "--sequesterRsrc", "--keepParent", dist_path, zip_path],
check=True,
)
print()
print("✓ Done!")
print(f" App: {dist_path}")
print(f" Zip: {zip_path}")
print(f" {tip}")
else:
print()
print("✓ Done!")
print(f" Your app is at: {dist_path}")
print(f" {tip}")