- KDE/Windows accent-driven Material 3 theme, live updating - Library, tabbed playlists, smart/saved lists, queue, ratings - mpv and Qt Multimedia engines, EQ, ReplayGain, gapless - Synced lyrics (LRCLIB, NetEase, local .lrc), covers, MusicBrainz tags - Last.fm/ListenBrainz scrobbling, MPRIS, Windows media keys - Audio CD playback and ripping - PyInstaller, Inno Setup and AppImage builds via GitHub Actions Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01J7imThHV9BMkG24GaxPDeq
78 lines
3.1 KiB
Python
78 lines
3.1 KiB
Python
# PyInstaller spec — build with: pyinstaller packaging/mulberry.spec --noconfirm
|
|
import os
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(SPECPATH).resolve().parent
|
|
IS_WIN = sys.platform == "win32"
|
|
icon_dir = ROOT / "packaging" / "build-icons"
|
|
|
|
datas = [(str(ROOT / "mulberry" / "assets"), "mulberry/assets")]
|
|
binaries = []
|
|
# libmpv for Windows (CI downloads it into packaging/windows/mpv/)
|
|
mpv_dir = ROOT / "packaging" / "windows" / "mpv"
|
|
if IS_WIN and mpv_dir.is_dir():
|
|
for f in mpv_dir.glob("*.dll"):
|
|
binaries.append((str(f), "."))
|
|
|
|
hidden = ["mulberry.winmedia", "mulberry.mpris", "mutagen", "numpy", "mpv",
|
|
"PyQt6.QtMultimedia", "PyQt6.QtSvg", "PyQt6.QtNetwork"]
|
|
if not IS_WIN:
|
|
hidden.append("PyQt6.QtDBus")
|
|
|
|
excludes = ["PyQt6.QtWebEngineCore", "PyQt6.QtWebEngineWidgets", "PyQt6.QtQuick", "PyQt6.QtQml",
|
|
"PyQt6.Qt3DCore", "PyQt6.QtCharts", "PyQt6.QtDataVisualization", "PyQt6.QtBluetooth",
|
|
"PyQt6.QtPdf", "PyQt6.QtSql", "PyQt6.QtTest", "PyQt6.QtDesigner", "tkinter",
|
|
"matplotlib", "PIL", "scipy"]
|
|
|
|
a = Analysis(
|
|
[str(ROOT / "packaging" / "launcher.py")],
|
|
pathex=[str(ROOT)],
|
|
binaries=binaries,
|
|
datas=datas,
|
|
hiddenimports=hidden,
|
|
excludes=excludes,
|
|
noarchive=False,
|
|
)
|
|
# On Linux, libmpv (and its ~100 codec deps) must come from the system, not
|
|
# the bundle: drop it and everything only it pulls in.
|
|
if not IS_WIN:
|
|
import re
|
|
import subprocess
|
|
keep_basic = re.compile(r"^(libz|libssl|libcrypto|libffi|libexpat|liblzma|libbz2|libstdc|libgcc|"
|
|
r"libpython|libuuid|libreadline|libncurses|libtinfo|libsqlite|libmpdec)")
|
|
mpv_deps = set()
|
|
try:
|
|
import ctypes.util
|
|
lib = ctypes.util.find_library("mpv")
|
|
if lib:
|
|
out = subprocess.run(["bash", "-c", f"ldd $(ldconfig -p | grep -m1 '{lib}' | awk '{{print $NF}}')"],
|
|
capture_output=True, text=True).stdout
|
|
mpv_deps = {ln.split()[0] for ln in out.splitlines() if "=>" in ln}
|
|
except Exception:
|
|
pass
|
|
|
|
def unwanted(name):
|
|
base = os.path.basename(name)
|
|
if base.startswith("libmpv"):
|
|
return True
|
|
return base in mpv_deps and not keep_basic.match(base)
|
|
a.binaries = [b for b in a.binaries if not (unwanted(b[0]) and "PyQt6" not in b[1] and "numpy" not in b[1])]
|
|
|
|
# Qt modules Mulberry never uses (pulled in by plugins) — keeps the bundle lean
|
|
_drop = re.compile(r"(Qt6(Quick|Qml|Pdf|VirtualKeyboard|ShaderTools|3D|WebEngine|Designer)|libqgtk3|qpdf|"
|
|
r"qmltooling|libgtk-3|libgdk-3)", re.I) if True else None
|
|
a.binaries = [b for b in a.binaries if not _drop.search(b[0])]
|
|
a.datas = [d for d in a.datas if not _drop.search(d[0])]
|
|
|
|
pyz = PYZ(a.pure)
|
|
exe = EXE(
|
|
pyz, a.scripts, [],
|
|
exclude_binaries=True,
|
|
name="Mulberry" if IS_WIN else "mulberry",
|
|
console=False,
|
|
icon=str(icon_dir / "mulberry.ico") if (IS_WIN and (icon_dir / "mulberry.ico").exists()) else None,
|
|
version=str(ROOT / "packaging" / "windows" / "version.txt") if IS_WIN else None,
|
|
)
|
|
coll = COLLECT(exe, a.binaries, a.datas, strip=False, upx=False, name="Mulberry")
|