Files
BetterDSPControl/packaging/build.py
T
GivouandClaude Opus 5.5 fe13f261f7 Add BetterDSPControl: web UI, desktop app and Pi writer for t.racks DSP 204/408
- Python stdlib server with SSE live updates, PIN login, remote access
- Vanilla JS web UI (English/German): mixer, channel, routing, links, limiter calculator
- Preset file export/import with undo, settings backup, lock for the desktop app
- Network (TCP 9761) and USB HID transport (Windows, macOS, Linux)
- Desktop app via pywebview, Raspberry Pi SD card writer, simulator and protocol tests
- README with import guide for Claude Code, CLAUDE.md, protocol documentation

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 20:24:33 +01:00

64 lines
2.6 KiB
Python

"""Builds the desktop programs into dist/:
python -m pip install pyinstaller pywebview pillow
python packaging/build.py
Windows:
dist/DSP Control.exe desktop app (own window, no PIN; optional remote access with PIN)
dist/DSP Control Pi Writer.exe SD card writer for a Raspberry Pi running the WebUI
macOS:
dist/DSP Control.app the same desktop app
dist/DSP Control.dmg disk image with the app and a link to /Applications
"""
import shutil
import subprocess
import sys
import tempfile
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
SEP = ";" if sys.platform == "win32" else ":"
def pyinstaller(*args, onefile=True):
cmd = [sys.executable, "-m", "PyInstaller", "--noconfirm", "--onefile" if onefile else "--onedir", "--windowed",
"--distpath", str(ROOT / "dist"), "--workpath", str(ROOT / "build"), "--specpath", str(ROOT / "build"), *args]
print(">", " ".join(cmd))
subprocess.run(cmd, cwd=ROOT, check=True)
def data(src, dest="."):
return ["--add-data", f"{ROOT / src}{SEP}{dest}"]
def build_mac():
app = ROOT / "dist" / "DSP Control.app"
pyinstaller("--name", "DSP Control", "--icon", str(ROOT / "packaging" / "dsp-control.icns"),
"--osx-bundle-identifier", "at.thiemoo.dspcontrol", *data("static", "static"),
str(ROOT / "desktop.py"), onefile=False) # a .app bundle is always a folder
shutil.rmtree(ROOT / "dist" / "DSP Control", ignore_errors=True) # the loose onedir copy next to the .app
dmg = ROOT / "dist" / "DSP Control.dmg"
dmg.unlink(missing_ok=True)
with tempfile.TemporaryDirectory() as tmp:
shutil.copytree(app, Path(tmp) / app.name, symlinks=True)
(Path(tmp) / "Applications").symlink_to("/Applications")
subprocess.run(["hdiutil", "create", "-volname", "DSP Control", "-srcfolder", tmp, "-ov",
"-format", "UDZO", str(dmg)], check=True)
print("\nDone:", app.name, dmg.name, sep="\n ")
subprocess.run([sys.executable, str(ROOT / "packaging" / "make_icons.py")], check=True)
if sys.platform == "darwin":
build_mac()
sys.exit()
pyinstaller("--name", "DSP Control", "--icon", str(ROOT / "packaging" / "dsp-control.ico"),
*data("static", "static"), str(ROOT / "desktop.py"))
pyinstaller("--name", "DSP Control Pi Writer", "--icon", str(ROOT / "packaging" / "pi-writer.ico"), "--uac-admin",
*data("server.py"), *data("dsp", "dsp"), *data("static", "static"), str(ROOT / "pi_writer.py"))
print("\nDone:", *(p.name for p in (ROOT / "dist").glob("*.exe")), sep="\n ")