-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.py
More file actions
90 lines (73 loc) · 2.46 KB
/
Copy pathbuild.py
File metadata and controls
90 lines (73 loc) · 2.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
"""Build Pub-Streamer into a standalone Windows executable using Nuitka.
Usage (from project root):
uv run python build.py
On CI the GITHUB_ACTIONS env var is set automatically, which switches the
compiler to MinGW (GCC) — it handles the large generated C files that cause
MSVC to run out of heap on constrained machines.
"""
import os
import subprocess
import sys
import pathlib
ROOT = pathlib.Path(__file__).parent
DIST = ROOT / "dist"
LOCALE = ROOT / "locale"
SOUNDS = ROOT / "sounds"
ON_CI = os.environ.get("GITHUB_ACTIONS") == "true"
# Data directories to bundle as-is
data_dirs = []
if LOCALE.exists():
data_dirs.append(f"--include-data-dir={LOCALE}=locale")
if SOUNDS.exists():
data_dirs.append(f"--include-data-dir={SOUNDS}=sounds")
native_dir = ROOT / "native"
if native_dir.exists():
data_dirs.append(f"--include-data-dir={native_dir}=native")
plugins_dir = ROOT / "plugins"
if plugins_dir.exists():
data_dirs.append(f"--include-data-dir={plugins_dir}=plugins")
icon = ROOT / "pubstreamer" / "ui" / "icon.ico"
cmd = [
sys.executable, "-m", "nuitka",
"--standalone",
"--windows-console-mode=disable",
"--assume-yes-for-downloads",
# MinGW on CI — avoids MSVC heap exhaustion on large generated C files.
# Remove this line to force MSVC locally if you have enough RAM.
"--mingw64" if ON_CI else "",
f"--windows-icon-from-ico={icon}" if icon.exists() else "",
# Compile everything — no frozen-bytecode shortcuts.
"--follow-import-to=pubstreamer",
"--include-package=wx",
"--include-package=numpy",
"--include-package=pedalboard",
"--include-package=win32com",
"--include-package=win32api",
"--include-package=win32con",
"--include-package=pywintypes",
"--include-package=comtypes",
"--include-package=httpx",
"--include-package=httpcore",
"--include-package=certifi",
"--include-package=pyaudiowpatch",
"--include-package=edge_tts",
"--include-package=gtts",
"--include-package=google",
"--include-package=grpc",
"--include-package=pyasn1",
"--include-package=pyasn1_modules",
"--include-package=piper",
"--include-package=onnxruntime",
"--include-package=cffi",
"--include-package=aiohttp",
f"--output-dir={DIST}",
"--output-filename=PubStreamer",
*data_dirs,
"main.py",
]
cmd = [c for c in cmd if c]
print("Running Nuitka...")
print(" ".join(cmd))
print()
result = subprocess.run(cmd, cwd=ROOT)
sys.exit(result.returncode)