-
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pyinstaller builds for macOS and Linux in the CI (#1348)
* Build for macOS * Add sdl2 * add sdl2_image * Add assets back * Try pysdl2-dll * Pack theme * Add templates * add librsvg * List all files in .app * Try build with --wheel * Attempt to bundle phazor * Try adding pysdl2-dll and Rsvg as hidden imports * Attempt to throw DYLD_LIBRARY_PATH back into spec * Try adding librsvg-2.2.dylib * Try fixing localization * rsvg hidden import try #2 * Stop duping CustomLoggingFormatter * compile_translations.py: Throw a proper exception on error * Fix up command order * Install gettext * Use partial path for gettext * Move logging classes to a separate module * Cleanup and brew upgrade * Add locale dir * Fix brew commands * Which genius decided to litter the FS with this garbage * Remove extra space * cleanup glib and gettext * Attempt to bundle SDL2 prebuilt frameworks * Try importing hidden chromecast * try lower case pychromecast * Fix error message for setproctitle * Add support for PEP508 deps definitions * Remove duped dep * Add initial optdepends * Fix up deps * Move out import and add test exception * pyinstaller debug build * Try reverting deps changes * Kill optdepends in pyproject * Fix ext-modules * Fix optional * install pyinstaller in unified deps * Fix opus include * Init linux.spec * Add Linux CI * Swap macOS CI to unified reqs * Try fixing up hiddenimports * Linux CI: Add gobject-introspection * Linux CI: Add python3-gi-cairo * try adding libgirepository1.0-dev * Add libcairo2-dev * Linux CI: moar deps * Log error for SDL renderer errors too * Fix up CI * Editor is rendering pipes curved here... * Linux CI: Fix syntax * Jpeg XL dep * Try 24.10 * Make requirements.txt be the cross-platform full one * yeet JXLPY to temp pass CI * Fix backslash * test if sdl framework still gets copied * Linux CI: Clone submodules too * Linux CI: Add devel packages for audio * Linux CI: Add libsamplerate0-dev * Linux CI: Fix backslash * Try copying the entire sdl2dll dir * Rename compile translations job * Try adding zeroconf to reqs * Fix pychromecast on pyinstaller * Fix pyproject.toml indents * Clean up requirements a bit * Stop always printing pychromecast exception, now just to debug * Move Chrome() creation back to try block * pysdl fix attempt * try to switch over to dev pyinstaller better * Fix up reqs * Use pysdl2-dll on all OSs * Fix up Linux spec file * Try bumping ffmpeg from v5 to v7 * Ffmpeg v2 attempt numero duo * Attempt to add a Rsvg hook * Indent user files location * Add toggle console button to Misc * Log PATH when looking for ffmpeg * Add the second part necessary for Rsvg * Fix up DConsole self reference * Fix up optdeps * try hacking libjxl on Linux * Cleanup and document workarounds * Fix dpkg -i * Add libgif dep for jxl * Cleanup TODO notes * Try packaging ffmpeg better * Cleanup docs * Fix up action names
- Loading branch information
Showing
18 changed files
with
563 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
name: Build Linux app | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.13' | ||
|
||
- name: Install deps | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y \ | ||
gettext \ | ||
gobject-introspection \ | ||
libgirepository1.0-dev \ | ||
python3-gi-cairo \ | ||
libcairo2-dev \ | ||
libpipewire-0.3-dev \ | ||
libdbus-1-dev \ | ||
libjxl-dev \ | ||
libflac-dev \ | ||
libgme-dev \ | ||
libmpg123-dev \ | ||
libopenmpt-dev \ | ||
libopusfile-dev \ | ||
libsamplerate0-dev \ | ||
libvorbis-dev \ | ||
libwavpack-dev | ||
# JPEG-XL hack since 24.04 is too old | ||
sudo apt-get install -y \ | ||
libgif7 \ | ||
wget | ||
wget http://mirrors.kernel.org/ubuntu/pool/universe/j/jpeg-xl/libjxl-dev_0.10.3-4ubuntu1_amd64.deb | ||
wget http://mirrors.kernel.org/ubuntu/pool/universe/j/jpeg-xl/libjxl0.10_0.10.3-4ubuntu1_amd64.deb | ||
wget http://mirrors.kernel.org/ubuntu/pool/universe/h/highway/libhwy-dev_1.2.0-3ubuntu2_amd64.deb | ||
wget http://mirrors.kernel.org/ubuntu/pool/universe/h/highway/libhwy1t64_1.2.0-3ubuntu2_amd64.deb | ||
wget http://mirrors.kernel.org/ubuntu/pool/main/l/lcms2/liblcms2-dev_2.14-2build1_amd64.deb | ||
sudo dpkg -i *.deb | ||
- name: Install Python dependencies and setup venv | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m venv .venv | ||
source .venv/bin/activate | ||
pip install \ | ||
-r requirements.txt \ | ||
build \ | ||
pyinstaller | ||
- name: Build the project using python-build | ||
run: | | ||
source .venv/bin/activate | ||
python -m compile_translations | ||
python -m build --wheel | ||
- name: Install the project into a venv | ||
run: | | ||
source .venv/bin/activate | ||
pip install --prefix ".venv" dist/*.whl | ||
- name: "[DEBUG] List all files" | ||
run: find . | ||
|
||
- name: Build Linux App with PyInstaller | ||
run: | | ||
source .venv/bin/activate | ||
pyinstaller --log-level=DEBUG linux.spec | ||
- name: Create ZIP | ||
run: | | ||
mkdir -p dist/zip | ||
APP_NAME="TauonMusicBox" | ||
APP_PATH="dist/${APP_NAME}" | ||
ZIP_PATH="dist/zip/${APP_NAME}.zip" | ||
zip -r "${ZIP_PATH}" "${APP_PATH}" | ||
- name: Upload ZIP artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: TauonMusicBox-linux | ||
path: dist/zip/TauonMusicBox.zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Build macOS app | ||
|
||
on: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: macos-latest | ||
|
||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.13' | ||
|
||
- name: brew update and upgrade | ||
run: brew update && brew upgrade | ||
|
||
- name: Install brew dependencies | ||
run: | | ||
brew install \ | ||
gobject-introspection \ | ||
gtk+3 \ | ||
pango \ | ||
sdl2 \ | ||
sdl2_image \ | ||
jpeg-xl \ | ||
ffmpeg \ | ||
librsvg \ | ||
opusfile \ | ||
libopenmpt \ | ||
wavpack \ | ||
game-music-emu | ||
- name: Install Python dependencies and setup venv | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m venv .venv | ||
source .venv/bin/activate | ||
pip install \ | ||
-r requirements.txt \ | ||
build | ||
# Hack until https://github.com/pyinstaller/pyinstaller/issues/8936 is resolved | ||
pip install https://github.com/rokm/pyinstaller/archive/refs/heads/macos-nested-framework-bundles.zip | ||
# \ | ||
# pyinstaller | ||
# pip uninstall pyinstaller | ||
# CFLAGS: "-I/opt/homebrew/include" | ||
# LDFLAGS: "-L/opt/homebrew/lib" | ||
|
||
- name: Build the project using python-build | ||
run: | | ||
source .venv/bin/activate | ||
python -m compile_translations | ||
python -m build --wheel | ||
- name: Install the project into a venv | ||
run: | | ||
source .venv/bin/activate | ||
pip install --prefix ".venv" dist/*.whl | ||
- name: "[DEBUG] List all files" | ||
run: find . | ||
|
||
- name: Build macOS app with PyInstaller | ||
run: | | ||
source .venv/bin/activate | ||
pyinstaller --log-level=DEBUG mac.spec | ||
env: | ||
DYLD_LIBRARY_PATH: "/opt/homebrew/lib" | ||
|
||
- name: "[DEBUG] List all files in .app" | ||
run: find "dist/TauonMusicBox.app" | ||
|
||
- name: Create DMG | ||
run: | | ||
mkdir -p dist/dmg | ||
APP_NAME="TauonMusicBox" | ||
APP_PATH="dist/${APP_NAME}.app" | ||
DMG_PATH="dist/dmg/${APP_NAME}.dmg" | ||
# Create a .dmg package | ||
hdiutil create -volname "$APP_NAME" -srcfolder "$APP_PATH" -ov -format UDZO "$DMG_PATH" | ||
- name: Upload DMG artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: TauonMusicBox-dmg | ||
path: dist/dmg/TauonMusicBox.dmg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Tauon Linux CI | ||
name: Compile translations on Linux | ||
|
||
on: | ||
push: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
recursive-include src/phazor/kissfft *.h | ||
recursive-include src/phazor/miniaudio *.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from PyInstaller.utils.hooks.gi import GiModuleInfo | ||
|
||
module_info = GiModuleInfo("Rsvg", "2.0") | ||
if module_info.available: | ||
binaries, datas, hiddenimports = module_info.collect_typelib_data() |
16 changes: 16 additions & 0 deletions
16
extra/pyinstaller-hooks/pre_safe_import_module/hook-gi.repository.Rsvg.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#----------------------------------------------------------------------------- | ||
# Copyright (c) 2005-2023, PyInstaller Development Team. | ||
# | ||
# Distributed under the terms of the GNU General Public License (version 2 | ||
# or later) with exception for distributing the bootloader. | ||
# | ||
# The full license is in the file COPYING.txt, distributed with this software. | ||
# | ||
# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception) | ||
#----------------------------------------------------------------------------- | ||
|
||
|
||
def pre_safe_import_module(api): | ||
# PyGObject modules loaded through the gi repository are marked as MissingModules by modulegraph, so we convert them | ||
# to RuntimeModules in order for their hooks to be loaded and executed. | ||
api.add_runtime_module(api.module_name) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
|
||
|
||
a = Analysis( | ||
["src/tauon/__main__.py"], | ||
pathex=[], | ||
binaries=[], | ||
datas=[ | ||
("src/tauon/assets", "assets"), | ||
("src/tauon/locale", "locale"), | ||
("src/tauon/theme", "theme"), | ||
("src/tauon/templates", "templates"), | ||
# This could only have SDL2.framework and SDL2_image.framework to save space... | ||
(".venv/lib/python3.13/site-packages/sdl2dll/dll", "sdl2dll/dll"), | ||
# (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2.framework", "sdl2dll/dll/SDL2.framework"), | ||
# (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2_image.framework", "sdl2dll/dll/SDL2_image.framework"), | ||
], | ||
hiddenimports=[ | ||
"pylast", | ||
"phazor", | ||
# Zeroconf is hacked until this issue is resolved: https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/840 | ||
"zeroconf._utils.ipaddress", | ||
"zeroconf._handlers.answers", | ||
], | ||
hookspath=["extra/pyinstaller-hooks"], | ||
hooksconfig={}, | ||
runtime_hooks=[], | ||
excludes=[], | ||
noarchive=False, | ||
optimize=0, | ||
) | ||
pyz = PYZ(a.pure) | ||
|
||
exe = EXE( | ||
pyz, | ||
a.scripts, | ||
[], | ||
exclude_binaries=True, | ||
name="Tauon Music Box", | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
console=False, | ||
disable_windowed_traceback=False, | ||
argv_emulation=False, | ||
target_arch=None, | ||
codesign_identity=None, | ||
entitlements_file=None, | ||
) | ||
coll = COLLECT( | ||
exe, | ||
a.binaries, | ||
a.datas, | ||
strip=False, | ||
upx=True, | ||
upx_exclude=[], | ||
name="TauonMusicBox", | ||
) |
Oops, something went wrong.