v0.97.0: macOS port (Round 129): OS-aware paths, config and cookies; Mac now-playing, packaging (PyInstaller .app, dmg build, signing notes, CI workflow) and docs
macOS / Tests (AppleSilicon) (push) Canceled after 0s
macOS / Tests (Intel) (push) Canceled after 0s
macOS / Build (AppleSilicon) (push) Canceled after 0s
macOS / Build (Intel) (push) Canceled after 0s
macOS / Publish the GitHub Release (push) Canceled after 0s
macOS / Tests (AppleSilicon) (push) Canceled after 0s
macOS / Tests (Intel) (push) Canceled after 0s
macOS / Build (AppleSilicon) (push) Canceled after 0s
macOS / Build (Intel) (push) Canceled after 0s
macOS / Publish the GitHub Release (push) Canceled after 0s
This commit is contained in:
@@ -0,0 +1,128 @@
|
||||
# -*- mode: python -*-
|
||||
# PyInstaller spec for LinTunes.app (macOS, windowed, onedir).
|
||||
#
|
||||
# Run through packaging/mac/build.sh, which makes the venv, fetches the
|
||||
# bundled tools and signs the result. By hand, from the repo root:
|
||||
# pyinstaller --noconfirm --clean packaging/mac/LinTunes.spec
|
||||
#
|
||||
# What goes in, and why:
|
||||
# * every lintunes module (some are imported only inside functions, and
|
||||
# the Mac-only ones only on a Mac);
|
||||
# * the package data the app reads through importlib.resources or
|
||||
# Path(__file__): sounds, web-mix templates, Kaleidostrobe's tables,
|
||||
# the drag icon, and dj/_spleeter_run.py, which runs *by path* in the
|
||||
# Spleeter venv's own interpreter, so it must be a plain .py file;
|
||||
# * NOT the Rabbit R1 parts' data (lintunes/android/andTunes.apk and the
|
||||
# andtunes button art): the Mac app has no R1 features.
|
||||
# The bundled ffmpeg/fpcalc are copied in by build.sh after this runs.
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from PyInstaller.utils.hooks import collect_submodules
|
||||
|
||||
HERE = Path(SPECPATH).resolve() # noqa: F821 — PyInstaller's global
|
||||
ROOT = HERE.parents[1]
|
||||
sys.path.insert(0, str(HERE))
|
||||
sys.path.insert(0, str(ROOT))
|
||||
|
||||
import plist # noqa: E402 (packaging/mac/plist.py)
|
||||
from lintunes import release_info # noqa: E402
|
||||
|
||||
VERSION = plist.version()
|
||||
ARCH = os.environ.get("LINTUNES_ARCH") or None # None = this machine's
|
||||
|
||||
|
||||
def _optional_submodules(package):
|
||||
"""collect_submodules, tolerating a package that isn't installed
|
||||
(pyobjc on a machine without it)."""
|
||||
try:
|
||||
return collect_submodules(package)
|
||||
except Exception: # noqa: BLE001
|
||||
return []
|
||||
|
||||
|
||||
hiddenimports = []
|
||||
# All of lintunes, andtunes included (main_window imports it); only the
|
||||
# R1's data files are left out, below.
|
||||
hiddenimports += collect_submodules("lintunes")
|
||||
for pkg in ("pyatv", "pychromecast", "zeroconf", "mutagen", "casttube",
|
||||
"MediaPlayer", "AppKit", "Foundation", "objc"):
|
||||
hiddenimports += _optional_submodules(pkg)
|
||||
hiddenimports += [
|
||||
"PyQt6.QtMultimedia",
|
||||
"PyQt6.QtOpenGL",
|
||||
"PyQt6.QtOpenGLWidgets",
|
||||
"PyQt6.QtSvg", # the DJ shelf's check box art
|
||||
"numpy",
|
||||
"requests",
|
||||
"certifi",
|
||||
]
|
||||
|
||||
L = ROOT / "lintunes"
|
||||
datas = [
|
||||
(str(L / "sounds" / "tink.wav"), "lintunes/sounds"),
|
||||
(str(L / "sounds" / "airhorn.mp3"), "lintunes/sounds"),
|
||||
(str(L / "sounds" / "CREDITS.md"), "lintunes/sounds"),
|
||||
(str(L / "export" / "templates"), "lintunes/export/templates"),
|
||||
(str(L / "kaleidostrobe" / "tables.npz"), "lintunes/kaleidostrobe"),
|
||||
(str(L / "dj" / "_spleeter_run.py"), "lintunes/dj"),
|
||||
# gui/drag_ghost.py finds it at <package>/../packaging/drag-icon.png
|
||||
(str(ROOT / "packaging" / "drag-icon.png"), "packaging"),
|
||||
(str(HERE / "licenses"), "licenses"),
|
||||
(str(HERE / "THIRD-PARTY.md"), "licenses"),
|
||||
]
|
||||
|
||||
a = Analysis( # noqa: F821
|
||||
[str(HERE / "launch.py")],
|
||||
pathex=[str(ROOT)],
|
||||
binaries=[],
|
||||
datas=datas,
|
||||
hiddenimports=hiddenimports,
|
||||
hookspath=[],
|
||||
runtime_hooks=[str(HERE / "rthook_certifi.py")],
|
||||
excludes=[
|
||||
"tkinter", "_tkinter",
|
||||
"pytest", "IPython",
|
||||
# Qt modules nothing imports, in case a hook drags them in
|
||||
"PyQt6.QtWebEngineCore", "PyQt6.QtWebEngineWidgets",
|
||||
"PyQt6.QtQuick", "PyQt6.QtQml", "PyQt6.Qt3DCore",
|
||||
"PyQt6.QtBluetooth", "PyQt6.QtNfc", "PyQt6.QtPdf",
|
||||
],
|
||||
noarchive=False,
|
||||
)
|
||||
pyz = PYZ(a.pure) # noqa: F821
|
||||
|
||||
exe = EXE( # noqa: F821
|
||||
pyz,
|
||||
a.scripts,
|
||||
[],
|
||||
exclude_binaries=True,
|
||||
name=release_info.APP_NAME,
|
||||
debug=False,
|
||||
strip=False,
|
||||
upx=False, # UPX breaks Mach-O signatures
|
||||
console=False,
|
||||
# Qt receives the Finder's open-file Apple events itself
|
||||
# (QFileOpenEvent); PyInstaller's emulation would swallow them.
|
||||
argv_emulation=False,
|
||||
target_arch=ARCH,
|
||||
codesign_identity=None, # build.sh signs the whole bundle
|
||||
entitlements_file=None,
|
||||
)
|
||||
coll = COLLECT( # noqa: F821
|
||||
exe,
|
||||
a.binaries,
|
||||
a.datas,
|
||||
strip=False,
|
||||
upx=False,
|
||||
name=release_info.APP_NAME,
|
||||
)
|
||||
app = BUNDLE( # noqa: F821
|
||||
coll,
|
||||
name=f"{release_info.APP_NAME}.app",
|
||||
icon=str(HERE / "LinTunes.icns"),
|
||||
bundle_identifier=release_info.BUNDLE_ID,
|
||||
version=VERSION,
|
||||
info_plist=plist.info_plist(VERSION),
|
||||
)
|
||||
Reference in New Issue
Block a user