From fa8477204abbfcfedbe4d61d910266a5a02bb413 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 13:07:39 +0100 Subject: [PATCH 01/97] Build for macOS --- .github/workflows/build_macOS.yaml | 81 +++++++++++++++++ MANIFEST.in | 2 + mac.spec | 137 +++++++++++++++++------------ pyproject.toml | 13 ++- requirements_macos.txt | 12 +++ requirements_optional.txt | 2 +- 6 files changed, 186 insertions(+), 61 deletions(-) create mode 100644 .github/workflows/build_macOS.yaml create mode 100644 MANIFEST.in create mode 100644 requirements_macos.txt diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml new file mode 100644 index 000000000..54c7fd5e8 --- /dev/null +++ b/.github/workflows/build_macOS.yaml @@ -0,0 +1,81 @@ +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 + run: brew update + + - name: Install brew dependencies + run: brew install glib gobject-introspection gtk+3 pango jpeg-xl ffmpeg@5 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_macos.txt \ + -r requirements_optional.txt \ + build \ + pyinstaller + + - name: Build the project using python-build + run: | + source .venv/bin/activate + python -m build + find . +# python -m compile_translations # TODO + env: + CFLAGS: "-I/opt/homebrew/include" + LDFLAGS: "-L/opt/homebrew/lib" + + - name: Install the project into a venv + run: | + source .venv/bin/activate + pip install --prefix ".venv" dist/*.whl + find . + env: + CFLAGS: "-I/opt/homebrew/include" + LDFLAGS: "-L/opt/homebrew/lib" + + - name: Build macOS app with PyInstaller + run: | + source .venv/bin/activate + pyinstaller mac.spec + env: + CFLAGS: "-I/opt/homebrew/include" + LDFLAGS: "-L/opt/homebrew/lib" + DYLD_LIBRARY_PATH: "/opt/homebrew/lib" + + - 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 diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 000000000..5a499f658 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,2 @@ +recursive-include src/phazor/kissfft *.h +recursive-include src/phazor/miniaudio *.h diff --git a/mac.spec b/mac.spec index cf5df1a79..546a25901 100644 --- a/mac.spec +++ b/mac.spec @@ -1,60 +1,83 @@ -# -*- mode: python ; coding: utf-8 -*- - +import os +import subprocess block_cipher = None -import subprocess -prefix = subprocess.run(['brew', '--prefix'], capture_output=True, text=True).stdout.strip() - - -a = Analysis(['tauon.py'], - binaries=[('lib/libphazor.so', 'lib/'), - (prefix + '/bin/ffmpeg', '.'), - (prefix + '/lib/*.dylib', '.'), - ], - datas=[('assets', 'assets'), ('theme', 'theme'), ('input.txt', '.')], - hiddenimports=['sdl2', 'pylast'], - hookspath=['extra/pyinstaller-hooks'], - hooksconfig={}, - runtime_hooks=[], - excludes=[], - win_no_prefer_redirects=False, - win_private_assemblies=False, - cipher=block_cipher, - noarchive=False) -pyz = PYZ(a.pure, a.zipped_data, - cipher=block_cipher) - -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, - target_arch=None, - codesign_identity=None, - entitlements_file=None , icon='assets/tau-mac.icns') -coll = COLLECT(exe, - a.binaries, - a.zipfiles, - a.datas, - strip=False, - upx=True, - upx_exclude=[], - name='TauonMusicBox') -app = BUNDLE(coll, - name='TauonMusicBox.app', - icon='assets/tau-mac.icns', - bundle_identifier=None, - info_plist={ - 'LSEnvironment': { - 'LANG': 'en_US.UTF-8', - 'LC_CTYPE': 'en_US.UTF-8' - } - } - ) +# Should resolve as /opt/homebrew +prefix = subprocess.run(["brew", "--prefix"], capture_output=True, text=True).stdout.strip() + +libs = [ + "libpangocairo-1.0.0.dylib", + "libharfbuzz.0.dylib", + "libgobject-2.0.0.dylib", + "libgio-2.0.0.dylib", +] + +lib_paths = [(f"{prefix}/lib/{lib}", ".") for lib in libs] + +a = Analysis( + ["src/tauon/__main__.py"], + binaries=[ + *lib_paths, + (f"{prefix}/Cellar/ffmpeg@5", "."), + ], +# datas=[ +# ("src/tauon/assets", "assets")], + hiddenimports=["sdl2", "pylast"], + hookspath=["extra/pyinstaller-hooks"], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=block_cipher, + noarchive=False) + +pyz = PYZ( + a.pure, + a.zipped_data, + cipher=block_cipher) + +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, + target_arch=None, + codesign_identity=None, + entitlements_file=None, + icon="src/tauon/assets/tau-mac.icns") + +coll = COLLECT( + exe, + a.binaries, + a.zipfiles, + a.datas, + strip=False, + upx=True, + upx_exclude=[], + name="TauonMusicBox") + +app = BUNDLE( + coll, + name="TauonMusicBox.app", + icon="src/tauon/assets/tau-mac.icns", + bundle_identifier=None, + info_plist={ + "LSEnvironment": { + "LANG": "en_US.UTF-8", + "LC_CTYPE": "en_US.UTF-8", + # Set DYLD_LIBRARY_PATH to ensure the app can locate dynamic libraries +# "DYLD_LIBRARY_PATH": f"{prefix}/lib", + }}) + +for lib in lib_paths: + lib_name, _ = lib + os.system(f'install_name_tool -add_rpath "@executable_path/." "{lib_name}"') diff --git a/pyproject.toml b/pyproject.toml index a73db2307..5d2ecfc4a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,9 +47,14 @@ # {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["src/phazor/miniaudio", "C:/Users/Yeet/Tauon/src/phazor/miniaudio", "C:/Users/Yeet/Tauon/vcpkg/installed/x64-windows/include", "C:/Users/Yeet/Tauon/src/phazor/kissfft", "C:/Users/Yeet/Tauon/src/phazor/miniaudio"], libraries=["samplerate", "wavpackdll", "opusfile", "ogg", "opus", "vorbisfile", "mpg123", "FLAC", "openmpt", "pthreadVC3", "gme"], library-dirs = ["vcpkg/installed/x64-windows/lib"] },] # Linux +# ext-modules = [ +# {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme"] }, +# {name = "phazor-pw", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme", "pipewire-0.3"] },] + + # macOS ext-modules = [ - {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme"] }, - {name = "phazor-pw", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme", "pipewire-0.3"] },] + {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/opt/homebrew/include/opus", "src/phazor/kissfft", "/opt/homebrew/include"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme"], library-dirs = ["/opt/homebrew/lib"] },] +# {name = "phazor-pw", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/opt/homebrew/include/opus", "src/phazor/kissfft", "/opt/homebrew/include"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme", "pipewire-0.3"], library-dirs = ["/opt/homebrew/lib"] },] package-dir = {"" = "src"} @@ -66,7 +71,9 @@ # Windows # dependencies = {file = "requirements_windows.txt"} # Linux - dependencies = {file = "requirements.txt"} +# dependencies = {file = "requirements.txt"} + # macOS + dependencies = {file = "requirements_macos.txt"} [tool.setuptools.package-data] "tauon" = ["assets/*", "assets/svg/*", "locale/*/*/*.mo", "templates/*", "theme/*"] diff --git a/requirements_macos.txt b/requirements_macos.txt new file mode 100644 index 000000000..b5262cf96 --- /dev/null +++ b/requirements_macos.txt @@ -0,0 +1,12 @@ +beautifulsoup4 +#dbus-python # Linux dep +musicbrainzngs +mutagen +Pillow +PlexAPI +PyGObject +pylast>=3.1.0 +PySDL2 +requests +Send2Trash +unidecode diff --git a/requirements_optional.txt b/requirements_optional.txt index c8233eb16..b742e12cb 100644 --- a/requirements_optional.txt +++ b/requirements_optional.txt @@ -1,5 +1,5 @@ colored_traceback -jxlpy +#jxlpy # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563 #librespot - https://github.com/kokarare1212/librespot-python/pull/286 natsort opencc From e87cbbb154049c3d47b7eae12789390d23d304bb Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 14:01:46 +0100 Subject: [PATCH 02/97] Add sdl2 --- .github/workflows/build_macOS.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index 54c7fd5e8..c180e02ac 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -23,7 +23,7 @@ jobs: run: brew update - name: Install brew dependencies - run: brew install glib gobject-introspection gtk+3 pango jpeg-xl ffmpeg@5 opusfile libopenmpt wavpack game-music-emu + run: brew install glib gobject-introspection gtk+3 pango sdl2 jpeg-xl ffmpeg@5 opusfile libopenmpt wavpack game-music-emu - name: Install Python dependencies and setup venv run: | From c2b3c98a24724b0f37df96d25e93201b00eb197b Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 14:02:30 +0100 Subject: [PATCH 03/97] add sdl2_image --- .github/workflows/build_macOS.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index c180e02ac..ca83f4fc4 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -23,7 +23,7 @@ jobs: run: brew update - name: Install brew dependencies - run: brew install glib gobject-introspection gtk+3 pango sdl2 jpeg-xl ffmpeg@5 opusfile libopenmpt wavpack game-music-emu + run: brew install glib gobject-introspection gtk+3 pango sdl2 sdl2_image jpeg-xl ffmpeg@5 opusfile libopenmpt wavpack game-music-emu - name: Install Python dependencies and setup venv run: | From 555100c8b049ec60c5bf11ebcd2890221cab2e8c Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 14:11:30 +0100 Subject: [PATCH 04/97] Add assets back --- mac.spec | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mac.spec b/mac.spec index 546a25901..e3b91bc01 100644 --- a/mac.spec +++ b/mac.spec @@ -21,8 +21,8 @@ a = Analysis( *lib_paths, (f"{prefix}/Cellar/ffmpeg@5", "."), ], -# datas=[ -# ("src/tauon/assets", "assets")], + datas=[ + ("src/tauon/assets", "assets")], hiddenimports=["sdl2", "pylast"], hookspath=["extra/pyinstaller-hooks"], hooksconfig={}, From 48e1c1cabd6ea0bef6fa39613b264ec7f12acf83 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 14:47:45 +0100 Subject: [PATCH 05/97] Try pysdl2-dll --- requirements_macos.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements_macos.txt b/requirements_macos.txt index b5262cf96..002f6d829 100644 --- a/requirements_macos.txt +++ b/requirements_macos.txt @@ -6,6 +6,7 @@ Pillow PlexAPI PyGObject pylast>=3.1.0 +pysdl2-dll # Don't rely on system https://github.com/py-sdl/py-sdl2#requirements PySDL2 requests Send2Trash From df5f6d754a359dae4da5478a0a2601e1df65ab22 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 14:49:06 +0100 Subject: [PATCH 06/97] Pack theme --- mac.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mac.spec b/mac.spec index e3b91bc01..586608786 100644 --- a/mac.spec +++ b/mac.spec @@ -22,7 +22,8 @@ a = Analysis( (f"{prefix}/Cellar/ffmpeg@5", "."), ], datas=[ - ("src/tauon/assets", "assets")], + ("src/tauon/assets", "assets"), + ("src/tauon/theme", "theme")], hiddenimports=["sdl2", "pylast"], hookspath=["extra/pyinstaller-hooks"], hooksconfig={}, From 6598d8cea10001b8de027823dd64a60d37d4de1a Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 14:52:29 +0100 Subject: [PATCH 07/97] Add templates --- mac.spec | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mac.spec b/mac.spec index 586608786..82ed7d7e4 100644 --- a/mac.spec +++ b/mac.spec @@ -23,7 +23,9 @@ a = Analysis( ], datas=[ ("src/tauon/assets", "assets"), - ("src/tauon/theme", "theme")], + ("src/tauon/theme", "theme"), + ("src/tauon/templates", "templates"), + ], hiddenimports=["sdl2", "pylast"], hookspath=["extra/pyinstaller-hooks"], hooksconfig={}, From 2f71f2532c9e10a2a1dafcdd8fede802b0d88ab9 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 15:13:26 +0100 Subject: [PATCH 08/97] add librsvg --- .github/workflows/build_macOS.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index ca83f4fc4..a6ad080e4 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -23,7 +23,7 @@ jobs: run: brew update - name: Install brew dependencies - run: brew install glib gobject-introspection gtk+3 pango sdl2 sdl2_image jpeg-xl ffmpeg@5 opusfile libopenmpt wavpack game-music-emu + run: brew install glib gobject-introspection gtk+3 pango sdl2 sdl2_image jpeg-xl ffmpeg@5 librsvg opusfile libopenmpt wavpack game-music-emu - name: Install Python dependencies and setup venv run: | From 6c4a9023f6a677a9c8025d3a0bc9976081247604 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 15:33:21 +0100 Subject: [PATCH 09/97] List all files in .app --- .github/workflows/build_macOS.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index a6ad080e4..0df78c3d8 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -64,6 +64,9 @@ jobs: LDFLAGS: "-L/opt/homebrew/lib" 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 From 71913579a2a9284830564da64e57d3cefd196879 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 15:33:51 +0100 Subject: [PATCH 10/97] Try build with --wheel --- .github/workflows/build_macOS.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index 0df78c3d8..acde9f604 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -39,7 +39,7 @@ jobs: - name: Build the project using python-build run: | source .venv/bin/activate - python -m build + python -m build --wheel find . # python -m compile_translations # TODO env: From fd79d67d8fb0df1219c90678d9fcdccf820ac115 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 16:38:21 +0100 Subject: [PATCH 11/97] Attempt to bundle phazor --- mac.spec | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mac.spec b/mac.spec index 82ed7d7e4..8d35111e2 100644 --- a/mac.spec +++ b/mac.spec @@ -14,11 +14,13 @@ libs = [ ] lib_paths = [(f"{prefix}/lib/{lib}", ".") for lib in libs] +phazor_path = f"build/lib.macosx-10.13-universal2-cpython-313/phazor.cpython-313-darwin.so" a = Analysis( ["src/tauon/__main__.py"], binaries=[ *lib_paths, + (phazor_path, "."), (f"{prefix}/Cellar/ffmpeg@5", "."), ], datas=[ @@ -26,7 +28,7 @@ a = Analysis( ("src/tauon/theme", "theme"), ("src/tauon/templates", "templates"), ], - hiddenimports=["sdl2", "pylast"], + hiddenimports=["sdl2", "phazor", "pylast"], hookspath=["extra/pyinstaller-hooks"], hooksconfig={}, runtime_hooks=[], @@ -77,10 +79,9 @@ app = BUNDLE( "LSEnvironment": { "LANG": "en_US.UTF-8", "LC_CTYPE": "en_US.UTF-8", - # Set DYLD_LIBRARY_PATH to ensure the app can locate dynamic libraries -# "DYLD_LIBRARY_PATH": f"{prefix}/lib", }}) for lib in lib_paths: lib_name, _ = lib os.system(f'install_name_tool -add_rpath "@executable_path/." "{lib_name}"') + os.system(f'install_name_tool -add_rpath "@executable_path/." "{phazor_path}"') From 608a99a9a0ac4cd11408d21389e4bfa3581012df Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 16:49:41 +0100 Subject: [PATCH 12/97] Try adding pysdl2-dll and Rsvg as hidden imports --- mac.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mac.spec b/mac.spec index 8d35111e2..479f8a99b 100644 --- a/mac.spec +++ b/mac.spec @@ -28,7 +28,7 @@ a = Analysis( ("src/tauon/theme", "theme"), ("src/tauon/templates", "templates"), ], - hiddenimports=["sdl2", "phazor", "pylast"], + hiddenimports=["sdl2", "pysdl2-dll", "phazor", "pylast", "Rsvg"], hookspath=["extra/pyinstaller-hooks"], hooksconfig={}, runtime_hooks=[], From d8fd9c5e137fe87f8faaad74103fb5001028d138 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 17:08:19 +0100 Subject: [PATCH 13/97] Attempt to throw DYLD_LIBRARY_PATH back into spec --- mac.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mac.spec b/mac.spec index 479f8a99b..350ea4c53 100644 --- a/mac.spec +++ b/mac.spec @@ -79,6 +79,8 @@ app = BUNDLE( "LSEnvironment": { "LANG": "en_US.UTF-8", "LC_CTYPE": "en_US.UTF-8", + # Set DYLD_LIBRARY_PATH to ensure the app can locate dynamic libraries + "DYLD_LIBRARY_PATH": f"{prefix}/lib", }}) for lib in lib_paths: From b06a3b3ce4bee69ea47fd1042b1b4af7c2a13dea Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 17:32:15 +0100 Subject: [PATCH 14/97] Try adding librsvg-2.2.dylib --- mac.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/mac.spec b/mac.spec index 350ea4c53..97ce14920 100644 --- a/mac.spec +++ b/mac.spec @@ -11,6 +11,7 @@ libs = [ "libharfbuzz.0.dylib", "libgobject-2.0.0.dylib", "libgio-2.0.0.dylib", + "librsvg-2.2.dylib" ] lib_paths = [(f"{prefix}/lib/{lib}", ".") for lib in libs] From ada497466e041b4f411cd98424123d96fe531e85 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 17:36:48 +0100 Subject: [PATCH 15/97] Try fixing localization --- .github/workflows/build_macOS.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index acde9f604..b8066f660 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -38,10 +38,10 @@ jobs: - name: Build the project using python-build run: | + python -m compile_translations source .venv/bin/activate python -m build --wheel find . -# python -m compile_translations # TODO env: CFLAGS: "-I/opt/homebrew/include" LDFLAGS: "-L/opt/homebrew/lib" From 827aa1f7294e3218b4047221ff635934cd9bc365 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 18:06:15 +0100 Subject: [PATCH 16/97] rsvg hidden import try #2 --- mac.spec | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mac.spec b/mac.spec index 97ce14920..fe38956c1 100644 --- a/mac.spec +++ b/mac.spec @@ -23,13 +23,14 @@ a = Analysis( *lib_paths, (phazor_path, "."), (f"{prefix}/Cellar/ffmpeg@5", "."), +# ("/usr/lib/girepository-1.0/Rsvg-2.0.typelib", "."), ], datas=[ ("src/tauon/assets", "assets"), ("src/tauon/theme", "theme"), ("src/tauon/templates", "templates"), ], - hiddenimports=["sdl2", "pysdl2-dll", "phazor", "pylast", "Rsvg"], + hiddenimports=["sdl2", "pysdl2-dll", "phazor", "pylast", "Rsvg-2.0"], hookspath=["extra/pyinstaller-hooks"], hooksconfig={}, runtime_hooks=[], From 59988eb71abe01e445a1996c2a0be7867e4e7449 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 18:25:11 +0100 Subject: [PATCH 17/97] Stop duping CustomLoggingFormatter --- compile_translations.py | 33 +----------------------- src/tauon/__main__.py | 46 ++------------------------------- src/tauon/t_modules/t_extra.py | 47 +++++++++++++++++++++++++++++++++- 3 files changed, 49 insertions(+), 77 deletions(-) diff --git a/compile_translations.py b/compile_translations.py index 102d6f2bf..f66e36c95 100644 --- a/compile_translations.py +++ b/compile_translations.py @@ -3,38 +3,7 @@ import subprocess from pathlib import Path - -# TODO(Martin): import this class from tauon.py instead -class CustomLoggingFormatter(logging.Formatter): - """Nicely format logging.loglevel logs""" - - grey = "\x1b[38;20m" - grey_bold = "\x1b[38;1m" - yellow = "\x1b[33;20m" - yellow_bold = "\x1b[33;1m" - red = "\x1b[31;20m" - bold_red = "\x1b[31;1m" - reset = "\x1b[0m" - format = "%(asctime)s [%(levelname)s] [%(module)s] %(message)s" - format_verbose = "%(asctime)s [%(levelname)s] [%(module)s] %(message)s (%(filename)s:%(lineno)d)" - - FORMATS = { - logging.DEBUG: grey_bold + format_verbose + reset, - logging.INFO: yellow + format + reset, - logging.WARNING: yellow_bold + format + reset, - logging.ERROR: red + format + reset, - logging.CRITICAL: bold_red + format_verbose + reset, - } - - def format(self, record: dict) -> str: - log_fmt = self.FORMATS.get(record.levelno) - # Remove the miliseconds(%f) from the default string - date_fmt = "%Y-%m-%d %H:%M:%S" - formatter = logging.Formatter(log_fmt, date_fmt) - # Center align + min length things to prevent logs jumping around when switching between different values - record.levelname = f"{record.levelname:^7}" - record.module = f"{record.module:^10}" - return formatter.format(record) +from src.tauon.t_modules.t_extra import CustomLoggingFormatter # DEBUG+ to file and std_err logging.basicConfig( diff --git a/src/tauon/__main__.py b/src/tauon/__main__.py index 77119c0b3..75eca4a68 100755 --- a/src/tauon/__main__.py +++ b/src/tauon/__main__.py @@ -62,55 +62,13 @@ ) from sdl2.sdlimage import IMG_Load +from tauon.t_modules.t_extra import CustomLoggingFormatter, LogHistoryHandler + install_directory: Path = Path(__file__).resolve().parent sys.path.append(str(install_directory.parent)) from tauon.t_modules import t_bootstrap - -class CustomLoggingFormatter(logging.Formatter): - """Nicely format logging.loglevel logs""" - - grey = "\x1b[0;20m" - grey_bold = "\x1b[0;1m" - yellow = "\x1b[33;20m" - yellow_bold = "\x1b[33;1m" - red = "\x1b[31;20m" - bold_red = "\x1b[31;1m" - purple = "\x1b[0;35m" - reset = "\x1b[0m" - format = "%(asctime)s [%(levelname)s] [%(module)s] %(message)s" - format_verbose = "%(asctime)s [%(levelname)s] [%(module)s] %(message)s (%(filename)s:%(lineno)d)" - - # TODO(Martin): Add some way in which devel mode uses everything verbose - FORMATS = { - logging.DEBUG: grey_bold + format_verbose + reset, - logging.INFO: grey + format + reset, - logging.WARNING: purple + format_verbose + reset, - logging.ERROR: red + format_verbose + reset, - logging.CRITICAL: bold_red + format_verbose + reset, - } - - def format(self, record: dict) -> str: - log_fmt = self.FORMATS.get(record.levelno) - # Remove the miliseconds(%f) from the default string - date_fmt = "%Y-%m-%d %H:%M:%S" - formatter = logging.Formatter(log_fmt, date_fmt) - # Center align + min length things to prevent logs jumping around when switching between different values - record.levelname = f"{record.levelname:^7}" - record.module = f"{record.module:^10}" - return formatter.format(record) - -class LogHistoryHandler(logging.Handler): - def __init__(self): - super().__init__() - self.log_history = [] # List to store log messages - - def emit(self, record: dict): - self.log_history.append(record) # Append to the log history - if len(self.log_history) > 50: - del self.log_history[0] - log = LogHistoryHandler() formatter = logging.Formatter('[%(levelname)s] %(message)s') log.setFormatter(formatter) diff --git a/src/tauon/t_modules/t_extra.py b/src/tauon/t_modules/t_extra.py index 35bd2f3ca..b501d8c74 100644 --- a/src/tauon/t_modules/t_extra.py +++ b/src/tauon/t_modules/t_extra.py @@ -36,7 +36,8 @@ import urllib.parse import zipfile from dataclasses import dataclass -from typing import TYPE_CHECKING +from logging import LogRecord +from typing import TYPE_CHECKING, override from gi.repository import GLib @@ -45,6 +46,50 @@ from tauon.t_modules.t_main import TrackClass +class CustomLoggingFormatter(logging.Formatter): + """Nicely format logging.loglevel logs""" + + grey = "\x1b[0;20m" + grey_bold = "\x1b[0;1m" + yellow = "\x1b[33;20m" + yellow_bold = "\x1b[33;1m" + red = "\x1b[31;20m" + bold_red = "\x1b[31;1m" + purple = "\x1b[0;35m" + reset = "\x1b[0m" + format_simple = "%(asctime)s [%(levelname)s] [%(module)s] %(message)s" + format_verbose = "%(asctime)s [%(levelname)s] [%(module)s] %(message)s (%(filename)s:%(lineno)d)" + + # TODO(Martin): Add some way in which devel mode uses everything verbose + FORMATS = { + logging.DEBUG: grey_bold + format_verbose + reset, + logging.INFO: grey + format_simple + reset, + logging.WARNING: purple + format_verbose + reset, + logging.ERROR: red + format_verbose + reset, + logging.CRITICAL: bold_red + format_verbose + reset, + } + + @override + def format(self, record: LogRecord) -> str: + log_fmt = self.FORMATS.get(record.levelno) + # Remove the miliseconds(%f) from the default string + date_fmt = "%Y-%m-%d %H:%M:%S" + formatter = logging.Formatter(log_fmt, date_fmt) + # Center align + min length things to prevent logs jumping around when switching between different values + record.levelname = f"{record.levelname:^7}" + record.module = f"{record.module:^10}" + return formatter.format(record) + +class LogHistoryHandler(logging.Handler): + def __init__(self): + super().__init__() + self.log_history = [] # List to store log messages + + @override + def emit(self, record: LogRecord): + self.log_history.append(record) # Append to the log history + if len(self.log_history) > 50: + del self.log_history[0] @dataclass class TauonQueueItem: From a9fbbe256be150602b88efd62cfe253c08d6a30f Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 18:27:20 +0100 Subject: [PATCH 18/97] compile_translations.py: Throw a proper exception on error --- compile_translations.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/compile_translations.py b/compile_translations.py index f66e36c95..614c716cb 100644 --- a/compile_translations.py +++ b/compile_translations.py @@ -40,8 +40,7 @@ def main() -> None: try: subprocess.run(["/usr/bin/msgfmt", "-o", mo_path, po_path], check=True) except Exception: - # Don't log the exception to make the build log clear - logging.error(f"Failed to compile translations for {lang_file.name}") + logging.exception(f"Failed to compile translations for {lang_file.name}") compile_failure = True else: logging.info(f"Compiled: {lang_file.name}") From a5e84174a704b9271019a1693e7d920d9590f5f5 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 18:31:26 +0100 Subject: [PATCH 19/97] Fix up command order --- .github/workflows/build_macOS.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index b8066f660..14ed1a30d 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -38,8 +38,8 @@ jobs: - name: Build the project using python-build run: | - python -m compile_translations source .venv/bin/activate + python -m compile_translations python -m build --wheel find . env: From 83d383e286a58f25eaee889557d4dd99b16c0965 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 18:35:59 +0100 Subject: [PATCH 20/97] Install gettext --- .github/workflows/build_macOS.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index 14ed1a30d..6fff2b0ff 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -23,7 +23,7 @@ jobs: run: brew update - name: Install brew dependencies - run: brew install glib gobject-introspection gtk+3 pango sdl2 sdl2_image jpeg-xl ffmpeg@5 librsvg opusfile libopenmpt wavpack game-music-emu + run: brew install gettext glib gobject-introspection gtk+3 pango sdl2 sdl2_image jpeg-xl ffmpeg@5 librsvg opusfile libopenmpt wavpack game-music-emu - name: Install Python dependencies and setup venv run: | From ed208e64128af8907a8b916bb84914e590df5ee7 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 18:40:39 +0100 Subject: [PATCH 21/97] Use partial path for gettext --- compile_translations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile_translations.py b/compile_translations.py index 614c716cb..529e3e621 100644 --- a/compile_translations.py +++ b/compile_translations.py @@ -38,7 +38,7 @@ def main() -> None: if po_path.exists(): try: - subprocess.run(["/usr/bin/msgfmt", "-o", mo_path, po_path], check=True) + subprocess.run(["msgfmt", "-o", mo_path, po_path], check=True) except Exception: logging.exception(f"Failed to compile translations for {lang_file.name}") compile_failure = True From fe5e70438d67cc9bf6b2a7cf9ffe2536aae14695 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 18:48:52 +0100 Subject: [PATCH 22/97] Move logging classes to a separate module --- compile_translations.py | 2 +- src/tauon/__main__.py | 2 +- src/tauon/t_modules/logging.py | 49 ++++++++++++++++++++++++++++++++++ src/tauon/t_modules/t_extra.py | 48 +-------------------------------- 4 files changed, 52 insertions(+), 49 deletions(-) create mode 100644 src/tauon/t_modules/logging.py diff --git a/compile_translations.py b/compile_translations.py index 529e3e621..1f9fe7bac 100644 --- a/compile_translations.py +++ b/compile_translations.py @@ -3,7 +3,7 @@ import subprocess from pathlib import Path -from src.tauon.t_modules.t_extra import CustomLoggingFormatter +from src.tauon.t_modules.logging import CustomLoggingFormatter # DEBUG+ to file and std_err logging.basicConfig( diff --git a/src/tauon/__main__.py b/src/tauon/__main__.py index 75eca4a68..7ef6dc412 100755 --- a/src/tauon/__main__.py +++ b/src/tauon/__main__.py @@ -62,7 +62,7 @@ ) from sdl2.sdlimage import IMG_Load -from tauon.t_modules.t_extra import CustomLoggingFormatter, LogHistoryHandler +from tauon.t_modules.logging import CustomLoggingFormatter, LogHistoryHandler install_directory: Path = Path(__file__).resolve().parent sys.path.append(str(install_directory.parent)) diff --git a/src/tauon/t_modules/logging.py b/src/tauon/t_modules/logging.py new file mode 100644 index 000000000..3523b0301 --- /dev/null +++ b/src/tauon/t_modules/logging.py @@ -0,0 +1,49 @@ +import logging +from logging import LogRecord +from typing import override + + +class CustomLoggingFormatter(logging.Formatter): + """Nicely format logging.loglevel logs""" + + grey = "\x1b[0;20m" + grey_bold = "\x1b[0;1m" + yellow = "\x1b[33;20m" + yellow_bold = "\x1b[33;1m" + red = "\x1b[31;20m" + bold_red = "\x1b[31;1m" + purple = "\x1b[0;35m" + reset = "\x1b[0m" + format_simple = "%(asctime)s [%(levelname)s] [%(module)s] %(message)s" + format_verbose = "%(asctime)s [%(levelname)s] [%(module)s] %(message)s (%(filename)s:%(lineno)d)" + + # TODO(Martin): Add some way in which devel mode uses everything verbose + FORMATS = { + logging.DEBUG: grey_bold + format_verbose + reset, + logging.INFO: grey + format_simple + reset, + logging.WARNING: purple + format_verbose + reset, + logging.ERROR: red + format_verbose + reset, + logging.CRITICAL: bold_red + format_verbose + reset, + } + + @override + def format(self, record: LogRecord) -> str: + log_fmt = self.FORMATS.get(record.levelno) + # Remove the miliseconds(%f) from the default string + date_fmt = "%Y-%m-%d %H:%M:%S" + formatter = logging.Formatter(log_fmt, date_fmt) + # Center align + min length things to prevent logs jumping around when switching between different values + record.levelname = f"{record.levelname:^7}" + record.module = f"{record.module:^10}" + return formatter.format(record) + +class LogHistoryHandler(logging.Handler): + def __init__(self): + super().__init__() + self.log_history = [] # List to store log messages + + @override + def emit(self, record: LogRecord): + self.log_history.append(record) # Append to the log history + if len(self.log_history) > 50: + del self.log_history[0] diff --git a/src/tauon/t_modules/t_extra.py b/src/tauon/t_modules/t_extra.py index b501d8c74..6a65fe4fc 100644 --- a/src/tauon/t_modules/t_extra.py +++ b/src/tauon/t_modules/t_extra.py @@ -36,8 +36,7 @@ import urllib.parse import zipfile from dataclasses import dataclass -from logging import LogRecord -from typing import TYPE_CHECKING, override +from typing import TYPE_CHECKING from gi.repository import GLib @@ -46,51 +45,6 @@ from tauon.t_modules.t_main import TrackClass -class CustomLoggingFormatter(logging.Formatter): - """Nicely format logging.loglevel logs""" - - grey = "\x1b[0;20m" - grey_bold = "\x1b[0;1m" - yellow = "\x1b[33;20m" - yellow_bold = "\x1b[33;1m" - red = "\x1b[31;20m" - bold_red = "\x1b[31;1m" - purple = "\x1b[0;35m" - reset = "\x1b[0m" - format_simple = "%(asctime)s [%(levelname)s] [%(module)s] %(message)s" - format_verbose = "%(asctime)s [%(levelname)s] [%(module)s] %(message)s (%(filename)s:%(lineno)d)" - - # TODO(Martin): Add some way in which devel mode uses everything verbose - FORMATS = { - logging.DEBUG: grey_bold + format_verbose + reset, - logging.INFO: grey + format_simple + reset, - logging.WARNING: purple + format_verbose + reset, - logging.ERROR: red + format_verbose + reset, - logging.CRITICAL: bold_red + format_verbose + reset, - } - - @override - def format(self, record: LogRecord) -> str: - log_fmt = self.FORMATS.get(record.levelno) - # Remove the miliseconds(%f) from the default string - date_fmt = "%Y-%m-%d %H:%M:%S" - formatter = logging.Formatter(log_fmt, date_fmt) - # Center align + min length things to prevent logs jumping around when switching between different values - record.levelname = f"{record.levelname:^7}" - record.module = f"{record.module:^10}" - return formatter.format(record) - -class LogHistoryHandler(logging.Handler): - def __init__(self): - super().__init__() - self.log_history = [] # List to store log messages - - @override - def emit(self, record: LogRecord): - self.log_history.append(record) # Append to the log history - if len(self.log_history) > 50: - del self.log_history[0] - @dataclass class TauonQueueItem: """TauonQueueItem is [trackid, position, playlist_id, type, album_stage, uid_gen(), auto_stop] From 73ff9e1b0e04034a26b1f5869a8daefffa397dac Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 19:34:14 +0100 Subject: [PATCH 23/97] Cleanup and brew upgrade --- .github/workflows/build_macOS.yaml | 27 +++++++++++++++------------ mac.spec | 2 +- pyproject.toml | 1 - src/tauon/t_modules/t_extra.py | 1 + 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index 6fff2b0ff..ecb32e79b 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -19,8 +19,10 @@ jobs: with: python-version: 3.13 - - name: brew update - run: brew update + - name: brew update and upgrade + run: \ + brew update \ + brew upgrade - name: Install brew dependencies run: brew install gettext glib gobject-introspection gtk+3 pango sdl2 sdl2_image jpeg-xl ffmpeg@5 librsvg opusfile libopenmpt wavpack game-music-emu @@ -41,28 +43,29 @@ jobs: source .venv/bin/activate python -m compile_translations python -m build --wheel - find . - env: - CFLAGS: "-I/opt/homebrew/include" - LDFLAGS: "-L/opt/homebrew/lib" +# env: +# CFLAGS: "-I/opt/homebrew/include" +# LDFLAGS: "-L/opt/homebrew/lib" - name: Install the project into a venv run: | source .venv/bin/activate pip install --prefix ".venv" dist/*.whl - find . - env: - CFLAGS: "-I/opt/homebrew/include" - LDFLAGS: "-L/opt/homebrew/lib" +# env: +# CFLAGS: "-I/opt/homebrew/include" +# LDFLAGS: "-L/opt/homebrew/lib" + + - name: "[DEBUG] List all files" + run: find . - name: Build macOS app with PyInstaller run: | source .venv/bin/activate pyinstaller mac.spec env: - CFLAGS: "-I/opt/homebrew/include" - LDFLAGS: "-L/opt/homebrew/lib" DYLD_LIBRARY_PATH: "/opt/homebrew/lib" +# CFLAGS: "-I/opt/homebrew/include" +# LDFLAGS: "-L/opt/homebrew/lib" - name: "[DEBUG] List all files in .app" run: find "dist/TauonMusicBox.app" diff --git a/mac.spec b/mac.spec index fe38956c1..3678880ed 100644 --- a/mac.spec +++ b/mac.spec @@ -82,7 +82,7 @@ app = BUNDLE( "LANG": "en_US.UTF-8", "LC_CTYPE": "en_US.UTF-8", # Set DYLD_LIBRARY_PATH to ensure the app can locate dynamic libraries - "DYLD_LIBRARY_PATH": f"{prefix}/lib", +# "DYLD_LIBRARY_PATH": f"{prefix}/lib", }}) for lib in lib_paths: diff --git a/pyproject.toml b/pyproject.toml index 5d2ecfc4a..2d6f9b472 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -54,7 +54,6 @@ # macOS ext-modules = [ {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/opt/homebrew/include/opus", "src/phazor/kissfft", "/opt/homebrew/include"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme"], library-dirs = ["/opt/homebrew/lib"] },] -# {name = "phazor-pw", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/opt/homebrew/include/opus", "src/phazor/kissfft", "/opt/homebrew/include"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme", "pipewire-0.3"], library-dirs = ["/opt/homebrew/lib"] },] package-dir = {"" = "src"} diff --git a/src/tauon/t_modules/t_extra.py b/src/tauon/t_modules/t_extra.py index 6a65fe4fc..35bd2f3ca 100644 --- a/src/tauon/t_modules/t_extra.py +++ b/src/tauon/t_modules/t_extra.py @@ -45,6 +45,7 @@ from tauon.t_modules.t_main import TrackClass + @dataclass class TauonQueueItem: """TauonQueueItem is [trackid, position, playlist_id, type, album_stage, uid_gen(), auto_stop] From 774a175e2a3a34c2d58420b8171821d5b2a70d53 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 19:37:09 +0100 Subject: [PATCH 24/97] Add locale dir --- mac.spec | 1 + 1 file changed, 1 insertion(+) diff --git a/mac.spec b/mac.spec index 3678880ed..5cd49eda0 100644 --- a/mac.spec +++ b/mac.spec @@ -27,6 +27,7 @@ a = Analysis( ], datas=[ ("src/tauon/assets", "assets"), + ("src/tauon/locale", "locale"), ("src/tauon/theme", "theme"), ("src/tauon/templates", "templates"), ], From ec9f37de86b966be59ce4938fc494827f1c8cec6 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 19:38:52 +0100 Subject: [PATCH 25/97] Fix brew commands --- .github/workflows/build_macOS.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index ecb32e79b..8f09f7a61 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -20,9 +20,7 @@ jobs: python-version: 3.13 - name: brew update and upgrade - run: \ - brew update \ - brew upgrade + run: brew update && brew upgrade - name: Install brew dependencies run: brew install gettext glib gobject-introspection gtk+3 pango sdl2 sdl2_image jpeg-xl ffmpeg@5 librsvg opusfile libopenmpt wavpack game-music-emu From 9b95b881de2f0980691ec5c057319d68af510b2e Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 19:51:01 +0100 Subject: [PATCH 26/97] Which genius decided to litter the FS with this garbage --- compile_translations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile_translations.py b/compile_translations.py index 1f9fe7bac..21e476de5 100644 --- a/compile_translations.py +++ b/compile_translations.py @@ -25,7 +25,7 @@ def main() -> None: for lang_file in languages: - if lang_file.name == "messages.pot": + if lang_file.name in ("messages.pot", " .DS_Store"): continue po_path = locale_folder / lang_file.name / "LC_MESSAGES" / "tauon.po" From d443fdca9d7d56d2481ec7bad1b5f2706be92c88 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 19:51:24 +0100 Subject: [PATCH 27/97] Remove extra space --- compile_translations.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compile_translations.py b/compile_translations.py index 21e476de5..a0834765a 100644 --- a/compile_translations.py +++ b/compile_translations.py @@ -25,7 +25,7 @@ def main() -> None: for lang_file in languages: - if lang_file.name in ("messages.pot", " .DS_Store"): + if lang_file.name in ("messages.pot", ".DS_Store"): continue po_path = locale_folder / lang_file.name / "LC_MESSAGES" / "tauon.po" From ba7b0095128ca145dca7ea66187837923f93a7fc Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 19:54:07 +0100 Subject: [PATCH 28/97] cleanup glib and gettext --- .github/workflows/build_macOS.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index 8f09f7a61..59b31e7ac 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -23,7 +23,7 @@ jobs: run: brew update && brew upgrade - name: Install brew dependencies - run: brew install gettext glib gobject-introspection gtk+3 pango sdl2 sdl2_image jpeg-xl ffmpeg@5 librsvg opusfile libopenmpt wavpack game-music-emu + run: brew install gobject-introspection gtk+3 pango sdl2 sdl2_image jpeg-xl ffmpeg@5 librsvg opusfile libopenmpt wavpack game-music-emu - name: Install Python dependencies and setup venv run: | From 4045313acaea4765299f18938abd8df1c4a45bac Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 20:24:25 +0100 Subject: [PATCH 29/97] Attempt to bundle SDL2 prebuilt frameworks --- mac.spec | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mac.spec b/mac.spec index 5cd49eda0..fe1a839a1 100644 --- a/mac.spec +++ b/mac.spec @@ -30,6 +30,8 @@ a = Analysis( ("src/tauon/locale", "locale"), ("src/tauon/theme", "theme"), ("src/tauon/templates", "templates"), + (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2.framework", "."), + (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2_image.framework", "."), ], hiddenimports=["sdl2", "pysdl2-dll", "phazor", "pylast", "Rsvg-2.0"], hookspath=["extra/pyinstaller-hooks"], From 97f2f3f531928e1ac472dffe6930dce91e2bf77f Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 23:33:45 +0100 Subject: [PATCH 30/97] Try importing hidden chromecast --- mac.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mac.spec b/mac.spec index fe1a839a1..e73c158fe 100644 --- a/mac.spec +++ b/mac.spec @@ -33,7 +33,7 @@ a = Analysis( (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2.framework", "."), (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2_image.framework", "."), ], - hiddenimports=["sdl2", "pysdl2-dll", "phazor", "pylast", "Rsvg-2.0"], + hiddenimports=["sdl2", "PyChromecast", "phazor", "pylast", "Rsvg-2.0"], hookspath=["extra/pyinstaller-hooks"], hooksconfig={}, runtime_hooks=[], From 048dbdca46a281d3aae638b7f57552f72a51933b Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Tue, 17 Dec 2024 23:42:26 +0100 Subject: [PATCH 31/97] try lower case pychromecast --- mac.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mac.spec b/mac.spec index e73c158fe..e6b45f78c 100644 --- a/mac.spec +++ b/mac.spec @@ -33,7 +33,7 @@ a = Analysis( (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2.framework", "."), (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2_image.framework", "."), ], - hiddenimports=["sdl2", "PyChromecast", "phazor", "pylast", "Rsvg-2.0"], + hiddenimports=["sdl2", "pychromecast", "phazor", "pylast", "Rsvg-2.0"], hookspath=["extra/pyinstaller-hooks"], hooksconfig={}, runtime_hooks=[], From 99103f9455f48682df39fed19ef04824f2d921a2 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Dec 2024 00:00:32 +0100 Subject: [PATCH 32/97] Fix error message for setproctitle --- src/tauon/t_modules/t_main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tauon/t_modules/t_main.py b/src/tauon/t_modules/t_main.py index ed13d1835..a1f3b5fc1 100644 --- a/src/tauon/t_modules/t_main.py +++ b/src/tauon/t_modules/t_main.py @@ -364,7 +364,7 @@ except ModuleNotFoundError: logging.warning("Unable to import setproctitle, won't be setting process title.") except Exception: - logging.exception("Unknown error trying to import setproctitle, JPEG XL support will be disabled.") + logging.exception("Unknown error trying to import setproctitle, won't be setting process title.") else: setproctitle.setproctitle("tauonmb") From c22a8d2b4df36d05f6f9c45ea8f0134f735fcfdb Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Dec 2024 00:02:21 +0100 Subject: [PATCH 33/97] Add support for PEP508 deps definitions --- pyproject.toml | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2d6f9b472..035a58f1c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,39 @@ "Programming Language :: Python :: 3", "Typing :: Typed", ] - dynamic = ["dependencies"] +# dynamic = ["dependencies"] + dependencies = [ + "beautifulsoup4", + "musicbrainzngs", + "mutagen", + "PlexAPI", + "PyGObject", + "pylast>=3.1.0", + "PySDL2", + "requests", + "Send2Trash", + "unidecode", + "dbus-python; sys_platform == 'linux'", + "pysdl2-dll; sys_platform == 'darwin'", # Don't rely on system https://github.com/py-sdl/py-sdl2#requirements + "comtypes; sys_platform == 'win32'", + "infi.systray; sys_platform == 'win32'", + "keyboard; sys_platform == 'win32'", + "Pillow; sys_platform != 'win32'", + "opencc; sys_platform != 'win32'", # OPTDEP + "opencc-python-reimplemented; sys_platform == 'win32'", # OPTDEP + "pyinstaller; sys_platform != 'linux'", # for macOS at least + "pypresence", # optdep + "tekore", # optdep, + "natsort", # optdep + "jxlpy; sys_platform != 'darwin'", # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563 + #librespot - https://github.com/kokarare1212/librespot-python/pull/286 + #picard - picard 2.12.3 requires charset-normalizer~=3.3.2, but you have charset-normalizer 3.4.0 which is incompatible. + "plexapi", # OPTDEP + "PyChromecast", # OPTDEP + "setproctitle", # OPTDEP + "tidalapi", # OPTDEP + "colored_traceback", # very opt + ] [project.gui-scripts] tauonmb = "tauon.__main__:main" @@ -66,13 +98,13 @@ "tauon.t_modules" ] -[tool.setuptools.dynamic] - # Windows -# dependencies = {file = "requirements_windows.txt"} - # Linux -# dependencies = {file = "requirements.txt"} - # macOS - dependencies = {file = "requirements_macos.txt"} +#[tool.setuptools.dynamic] +# # Windows +## dependencies = {file = "requirements_windows.txt"} +# # Linux +## dependencies = {file = "requirements.txt"} +# # macOS +# dependencies = {file = "requirements_macos.txt"} [tool.setuptools.package-data] "tauon" = ["assets/*", "assets/svg/*", "locale/*/*/*.mo", "templates/*", "theme/*"] From 609ca7e27c11a15a3226687cc93a4c9355a30c38 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Dec 2024 00:04:54 +0100 Subject: [PATCH 34/97] Remove duped dep --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 035a58f1c..9bdd8d3cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,6 @@ "jxlpy; sys_platform != 'darwin'", # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563 #librespot - https://github.com/kokarare1212/librespot-python/pull/286 #picard - picard 2.12.3 requires charset-normalizer~=3.3.2, but you have charset-normalizer 3.4.0 which is incompatible. - "plexapi", # OPTDEP "PyChromecast", # OPTDEP "setproctitle", # OPTDEP "tidalapi", # OPTDEP From e4b815593bb3235d56f31058f90fcf2f7fd0e329 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Dec 2024 00:20:31 +0100 Subject: [PATCH 35/97] Add initial optdepends --- pyproject.toml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 9bdd8d3cc..b598234cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ "beautifulsoup4", "musicbrainzngs", "mutagen", - "PlexAPI", + "PlexAPI", # OPTDEP "PyGObject", "pylast>=3.1.0", "PySDL2", @@ -43,6 +43,14 @@ "colored_traceback", # very opt ] +[project.optional-dependencies] + dev = [ + "pygobject-stubs --config-settings=config=Gtk3,Gdk3", + ] + all = [ + "opencc; sys_platform != 'win32'", # OPTDEP + ] + [project.gui-scripts] tauonmb = "tauon.__main__:main" From 1fd6b57dce1964e684ee69dc15e1292a07c3c47f Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Dec 2024 00:27:37 +0100 Subject: [PATCH 36/97] Fix up deps --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index b598234cb..046475fbd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ [project.optional-dependencies] dev = [ - "pygobject-stubs --config-settings=config=Gtk3,Gdk3", + "pygobject-stubs", # needs PYGOBJECT_STUB_CONFIG=Gtk3,Gdk3 env var when being installed ] all = [ "opencc; sys_platform != 'win32'", # OPTDEP From ef76d6fa5834e2982dca6ed166a884fe9af05590 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Dec 2024 21:19:20 +0100 Subject: [PATCH 37/97] Move out import and add test exception --- src/tauon/t_modules/t_main.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tauon/t_modules/t_main.py b/src/tauon/t_modules/t_main.py index a1f3b5fc1..99cfd1af8 100644 --- a/src/tauon/t_modules/t_main.py +++ b/src/tauon/t_modules/t_main.py @@ -8997,12 +8997,14 @@ def wake(self) -> None: try: from tauon.t_modules.t_chrome import Chrome - chrome = Chrome(tauon) - logging.debug("Found import Chrome(pychromecast) for chromecast support") except ModuleNotFoundError: + logging.exception("Test exception DELETE THIS LINE.") logging.warning("Unable to import Chrome(pychromecast), chromecast support will be disabled.") except Exception: logging.exception("Unknown error trying to import Chrome(pychromecast), chromecast support will be disabled.") +finally: + chrome = Chrome(tauon) + logging.debug("Found import Chrome(pychromecast) for chromecast support") tauon.chrome = chrome From 9592672d51cd2ee2ed55dbfa91a400eaa5fe84c2 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Dec 2024 22:51:52 +0100 Subject: [PATCH 38/97] pyinstaller debug build --- .github/workflows/build_macOS.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index 59b31e7ac..dbc95f273 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -59,7 +59,7 @@ jobs: - name: Build macOS app with PyInstaller run: | source .venv/bin/activate - pyinstaller mac.spec + pyinstaller --log-level=DEBUG mac.spec env: DYLD_LIBRARY_PATH: "/opt/homebrew/lib" # CFLAGS: "-I/opt/homebrew/include" From e821df3b5e2e6e9b2c2c5813d6294990e3572e1b Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Dec 2024 22:58:51 +0100 Subject: [PATCH 39/97] Try reverting deps changes --- pyproject.toml | 69 ++++++++++++++++++++-------------------- requirements_unified.txt | 29 +++++++++++++++++ 2 files changed, 64 insertions(+), 34 deletions(-) create mode 100644 requirements_unified.txt diff --git a/pyproject.toml b/pyproject.toml index 046475fbd..334000631 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,38 +10,38 @@ "Programming Language :: Python :: 3", "Typing :: Typed", ] -# dynamic = ["dependencies"] - dependencies = [ - "beautifulsoup4", - "musicbrainzngs", - "mutagen", - "PlexAPI", # OPTDEP - "PyGObject", - "pylast>=3.1.0", - "PySDL2", - "requests", - "Send2Trash", - "unidecode", - "dbus-python; sys_platform == 'linux'", - "pysdl2-dll; sys_platform == 'darwin'", # Don't rely on system https://github.com/py-sdl/py-sdl2#requirements - "comtypes; sys_platform == 'win32'", - "infi.systray; sys_platform == 'win32'", - "keyboard; sys_platform == 'win32'", - "Pillow; sys_platform != 'win32'", - "opencc; sys_platform != 'win32'", # OPTDEP - "opencc-python-reimplemented; sys_platform == 'win32'", # OPTDEP - "pyinstaller; sys_platform != 'linux'", # for macOS at least - "pypresence", # optdep - "tekore", # optdep, - "natsort", # optdep - "jxlpy; sys_platform != 'darwin'", # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563 - #librespot - https://github.com/kokarare1212/librespot-python/pull/286 - #picard - picard 2.12.3 requires charset-normalizer~=3.3.2, but you have charset-normalizer 3.4.0 which is incompatible. - "PyChromecast", # OPTDEP - "setproctitle", # OPTDEP - "tidalapi", # OPTDEP - "colored_traceback", # very opt - ] + dynamic = ["dependencies"] +# dependencies = [ +# "beautifulsoup4", +# "musicbrainzngs", +# "mutagen", +# "PlexAPI", # OPTDEP +# "PyGObject", +# "pylast>=3.1.0", +# "PySDL2", +# "requests", +# "Send2Trash", +# "unidecode", +# "dbus-python; sys_platform == 'linux'", +# "pysdl2-dll; sys_platform == 'darwin'", # Don't rely on system https://github.com/py-sdl/py-sdl2#requirements +# "comtypes; sys_platform == 'win32'", +# "infi.systray; sys_platform == 'win32'", +# "keyboard; sys_platform == 'win32'", +# "Pillow; sys_platform != 'win32'", +# "opencc; sys_platform != 'win32'", # OPTDEP +# "opencc-python-reimplemented; sys_platform == 'win32'", # OPTDEP +# "pyinstaller; sys_platform != 'linux'", # for macOS at least +# "pypresence", # optdep +# "tekore", # optdep, +# "natsort", # optdep +# "jxlpy; sys_platform != 'darwin'", # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563 +# #librespot - https://github.com/kokarare1212/librespot-python/pull/286 +# #picard - picard 2.12.3 requires charset-normalizer~=3.3.2, but you have charset-normalizer 3.4.0 which is incompatible. +# "PyChromecast", # OPTDEP +# "setproctitle", # OPTDEP +# "tidalapi", # OPTDEP +# "colored_traceback", # very opt +# ] [project.optional-dependencies] dev = [ @@ -105,11 +105,12 @@ "tauon.t_modules" ] -#[tool.setuptools.dynamic] +[tool.setuptools.dynamic] +dependencies = {file = "requirements_unified.txt"} # # Windows ## dependencies = {file = "requirements_windows.txt"} # # Linux -## dependencies = {file = "requirements.txt"} +# dependencies = {file = "requirements.txt"} # # macOS # dependencies = {file = "requirements_macos.txt"} diff --git a/requirements_unified.txt b/requirements_unified.txt new file mode 100644 index 000000000..737a62150 --- /dev/null +++ b/requirements_unified.txt @@ -0,0 +1,29 @@ +beautifulsoup4 +musicbrainzngs +mutagen +PlexAPI +PyGObject +pylast>=3.1.0 +PySDL2 +requests +Send2Trash +unidecode +dbus-python; sys_platform == 'linux' +pysdl2-dll; sys_platform == 'darwin' # Don't rely on system https://github.com/py-sdl/py-sdl2#requirements +comtypes; sys_platform == 'win32' +infi.systray; sys_platform == 'win32' +keyboard; sys_platform == 'win32' +Pillow; sys_platform != 'win32' +opencc; sys_platform != 'win32' # OPTDEP +opencc-python-reimplemented; sys_platform == 'win32' # OPTDEP +pyinstaller; sys_platform != 'linux' # for macOS at least +pypresence # optdep +tekore # optdep, +natsort # optdep +jxlpy; sys_platform != 'darwin' # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563 +#librespot - https://github.com/kokarare1212/librespot-python/pull/286 +#picard - picard 2.12.3 requires charset-normalizer~=3.3.2, but you have charset-normalizer 3.4.0 which is incompatible. +PyChromecast # OPTDEP +setproctitle # OPTDEP +tidalapi # OPTDEP +colored_traceback # very opt From 847eb3a373bab17986152bad6de8828e2af006e9 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Dec 2024 22:59:26 +0100 Subject: [PATCH 40/97] Kill optdepends in pyproject --- pyproject.toml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 334000631..5b4160665 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -43,13 +43,13 @@ # "colored_traceback", # very opt # ] -[project.optional-dependencies] - dev = [ - "pygobject-stubs", # needs PYGOBJECT_STUB_CONFIG=Gtk3,Gdk3 env var when being installed - ] - all = [ - "opencc; sys_platform != 'win32'", # OPTDEP - ] +#[project.optional-dependencies] +# dev = [ +# "pygobject-stubs", # needs PYGOBJECT_STUB_CONFIG=Gtk3,Gdk3 env var when being installed +# ] +# all = [ +# "opencc; sys_platform != 'win32'", # OPTDEP +# ] [project.gui-scripts] tauonmb = "tauon.__main__:main" @@ -86,13 +86,13 @@ # {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["src/phazor/miniaudio", "C:/Users/Yeet/Tauon/src/phazor/miniaudio", "C:/Users/Yeet/Tauon/vcpkg/installed/x64-windows/include", "C:/Users/Yeet/Tauon/src/phazor/kissfft", "C:/Users/Yeet/Tauon/src/phazor/miniaudio"], libraries=["samplerate", "wavpackdll", "opusfile", "ogg", "opus", "vorbisfile", "mpg123", "FLAC", "openmpt", "pthreadVC3", "gme"], library-dirs = ["vcpkg/installed/x64-windows/lib"] },] # Linux -# ext-modules = [ -# {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme"] }, -# {name = "phazor-pw", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme", "pipewire-0.3"] },] + ext-modules = [ + {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme"] }, + {name = "phazor-pw", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme", "pipewire-0.3"] },] # macOS - ext-modules = [ - {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/opt/homebrew/include/opus", "src/phazor/kissfft", "/opt/homebrew/include"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme"], library-dirs = ["/opt/homebrew/lib"] },] +# ext-modules = [ +# {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/opt/homebrew/include/opus", "src/phazor/kissfft", "/opt/homebrew/include"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme"], library-dirs = ["/opt/homebrew/lib"] },] package-dir = {"" = "src"} From 7df2496e710a8df34747e13bd3ec4ab50a4e6eac Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Dec 2024 23:08:02 +0100 Subject: [PATCH 41/97] Fix ext-modules --- pyproject.toml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5b4160665..68943af18 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -85,10 +85,11 @@ # ext-modules = [ # {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["src/phazor/miniaudio", "C:/Users/Yeet/Tauon/src/phazor/miniaudio", "C:/Users/Yeet/Tauon/vcpkg/installed/x64-windows/include", "C:/Users/Yeet/Tauon/src/phazor/kissfft", "C:/Users/Yeet/Tauon/src/phazor/miniaudio"], libraries=["samplerate", "wavpackdll", "opusfile", "ogg", "opus", "vorbisfile", "mpg123", "FLAC", "openmpt", "pthreadVC3", "gme"], library-dirs = ["vcpkg/installed/x64-windows/lib"] },] - # Linux + # Linux + macOS ext-modules = [ - {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme"] }, - {name = "phazor-pw", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus"], libraries=["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme", "pipewire-0.3"] },] + {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus", "/opt/homebrew/include"], libraries = ["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme"], library-dirs = ["/opt/homebrew/lib"] }, + {name = "phazor-pw", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus"], libraries = ["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme", "pipewire-0.3"], optional = "True" }, + ] # macOS # ext-modules = [ From 58b498e4a2608a7a6e3e2e80cf307791207a9693 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Dec 2024 23:15:40 +0100 Subject: [PATCH 42/97] Fix optional --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 68943af18..843a85146 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,7 +88,7 @@ # Linux + macOS ext-modules = [ {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus", "/opt/homebrew/include"], libraries = ["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme"], library-dirs = ["/opt/homebrew/lib"] }, - {name = "phazor-pw", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus"], libraries = ["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme", "pipewire-0.3"], optional = "True" }, + {name = "phazor-pw", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus"], libraries = ["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme", "pipewire-0.3"], optional = true }, ] # macOS From 51afa35c7f46d919ca7b153f55e763b5869a3dc9 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Dec 2024 23:33:37 +0100 Subject: [PATCH 43/97] install pyinstaller in unified deps --- requirements_unified.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_unified.txt b/requirements_unified.txt index 737a62150..8a2240e2b 100644 --- a/requirements_unified.txt +++ b/requirements_unified.txt @@ -16,7 +16,7 @@ keyboard; sys_platform == 'win32' Pillow; sys_platform != 'win32' opencc; sys_platform != 'win32' # OPTDEP opencc-python-reimplemented; sys_platform == 'win32' # OPTDEP -pyinstaller; sys_platform != 'linux' # for macOS at least +pyinstaller # ; sys_platform != 'linux' # for macOS at least pypresence # optdep tekore # optdep, natsort # optdep From 083a802ed3d0a8ea7eb5ca5ed5a2c3f47f134660 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Dec 2024 23:38:10 +0100 Subject: [PATCH 44/97] Fix opus include --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 843a85146..1f554344c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -87,7 +87,7 @@ # Linux + macOS ext-modules = [ - {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus", "/opt/homebrew/include"], libraries = ["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme"], library-dirs = ["/opt/homebrew/lib"] }, + {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus", "/opt/homebrew/include/opus", "/opt/homebrew/include"], libraries = ["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme"], library-dirs = ["/opt/homebrew/lib"] }, {name = "phazor-pw", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus"], libraries = ["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme", "pipewire-0.3"], optional = true }, ] From dfe50940ae8c65366d887447844c5f2212732bc9 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Dec 2024 23:46:48 +0100 Subject: [PATCH 45/97] Init linux.spec --- linux.spec | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 linux.spec diff --git a/linux.spec b/linux.spec new file mode 100644 index 000000000..f323487da --- /dev/null +++ b/linux.spec @@ -0,0 +1,50 @@ + + +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"), +# (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2.framework", "."), +# (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2_image.framework", "."), + ], + hiddenimports=[], + hookspath=[], + 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", +) From 20c283fc216969006108bc13aace0acac78366ea Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Dec 2024 23:57:32 +0100 Subject: [PATCH 46/97] Add Linux CI --- .github/workflows/build_Linux.yaml | 61 ++++++++++++++++++++++++++++++ linux.spec | 4 +- 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/build_Linux.yaml diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml new file mode 100644 index 000000000..e9daed851 --- /dev/null +++ b/.github/workflows/build_Linux.yaml @@ -0,0 +1,61 @@ +name: Build Linux app + +on: + push: + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + with: + python-version: '3.13' + + - run: sudo apt-get update && sudo apt-get install -y gettext + + + - 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_unified.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 DMG + run: | + mkdir -p dist/dmg + APP_NAME="TauonMusicBox" + APP_PATH="dist/${APP_NAME}" + ZIP_PATH="dist/dmg/${APP_NAME}.zip" + + zip -r "${ZIP_PATH}" "${APP_PATH}" + + - name: Upload DMG artifact + uses: actions/upload-artifact@v4 + with: + name: TauonMusicBox-linux + path: dist/dmg/TauonMusicBox.zip diff --git a/linux.spec b/linux.spec index f323487da..fe8ca799e 100644 --- a/linux.spec +++ b/linux.spec @@ -12,8 +12,8 @@ a = Analysis( # (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2.framework", "."), # (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2_image.framework", "."), ], - hiddenimports=[], - hookspath=[], + hiddenimports=["pylast"], + hookspath=["extra/pyinstaller-hooks"], hooksconfig={}, runtime_hooks=[], excludes=[], From 25c3ce063279ba657542262c3fbd78d0d5373071 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Wed, 18 Dec 2024 23:57:41 +0100 Subject: [PATCH 47/97] Swap macOS CI to unified reqs --- .github/workflows/build_macOS.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index dbc95f273..2eaaec887 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -1,4 +1,4 @@ -name: Build macOS App +name: Build macOS app on: push: @@ -17,7 +17,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v5 with: - python-version: 3.13 + python-version: '3.13' - name: brew update and upgrade run: brew update && brew upgrade @@ -31,8 +31,7 @@ jobs: python -m venv .venv source .venv/bin/activate pip install \ - -r requirements_macos.txt \ - -r requirements_optional.txt \ + -r requirements_unified.txt \ build \ pyinstaller From 2e939505d6e2506ea269049edffcb54af3ab51e6 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 00:05:57 +0100 Subject: [PATCH 48/97] Try fixing up hiddenimports --- linux.spec | 2 +- mac.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/linux.spec b/linux.spec index fe8ca799e..edca3fe15 100644 --- a/linux.spec +++ b/linux.spec @@ -12,7 +12,7 @@ a = Analysis( # (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2.framework", "."), # (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2_image.framework", "."), ], - hiddenimports=["pylast"], + hiddenimports=["pylast", "zeroconf"], hookspath=["extra/pyinstaller-hooks"], hooksconfig={}, runtime_hooks=[], diff --git a/mac.spec b/mac.spec index e6b45f78c..8ce283ec6 100644 --- a/mac.spec +++ b/mac.spec @@ -33,7 +33,7 @@ a = Analysis( (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2.framework", "."), (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2_image.framework", "."), ], - hiddenimports=["sdl2", "pychromecast", "phazor", "pylast", "Rsvg-2.0"], + hiddenimports=["sdl2", "phazor", "pylast", "zeroconf"], hookspath=["extra/pyinstaller-hooks"], hooksconfig={}, runtime_hooks=[], From 5d8dd95f7988d694aed21ea804908ee76d94db5e Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 00:14:04 +0100 Subject: [PATCH 49/97] Linux CI: Add gobject-introspection --- .github/workflows/build_Linux.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index e9daed851..993d459c1 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -13,7 +13,7 @@ jobs: with: python-version: '3.13' - - run: sudo apt-get update && sudo apt-get install -y gettext + - run: sudo apt-get update && sudo apt-get install -y gettext gobject-introspection - name: Install Python dependencies and setup venv From c8050b6532555c9035ba593bebe9ad628931a05a Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 00:17:42 +0100 Subject: [PATCH 50/97] Linux CI: Add python3-gi-cairo --- .github/workflows/build_Linux.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index 993d459c1..85273192e 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -13,7 +13,7 @@ jobs: with: python-version: '3.13' - - run: sudo apt-get update && sudo apt-get install -y gettext gobject-introspection + - run: sudo apt-get update && sudo apt-get install -y gettext gobject-introspection python3-gi-cairo - name: Install Python dependencies and setup venv From 265bc9a4ebfc23f17e608254858316795d2b149f Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 00:30:22 +0100 Subject: [PATCH 51/97] try adding libgirepository1.0-dev --- .github/workflows/build_Linux.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index 85273192e..394e6846f 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -6,14 +6,14 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.13' - - run: sudo apt-get update && sudo apt-get install -y gettext gobject-introspection python3-gi-cairo + - run: sudo apt-get update && sudo apt-get install -y gettext gobject-introspection libgirepository1.0-dev python3-gi-cairo - name: Install Python dependencies and setup venv From df2d5dee0730db7ceda0e5ec878542fb98734354 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 00:39:08 +0100 Subject: [PATCH 52/97] Add libcairo2-dev --- .github/workflows/build_Linux.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index 394e6846f..52111032b 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -13,7 +13,7 @@ jobs: with: python-version: '3.13' - - run: sudo apt-get update && sudo apt-get install -y gettext gobject-introspection libgirepository1.0-dev python3-gi-cairo + - run: sudo apt-get update && sudo apt-get install -y gettext gobject-introspection libgirepository1.0-dev python3-gi-cairo libcairo2-dev - name: Install Python dependencies and setup venv From 33aca20ad8f6ce5f566aa63d59a1ed7231d0faeb Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 00:42:23 +0100 Subject: [PATCH 53/97] Linux CI: moar deps --- .github/workflows/build_Linux.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index 52111032b..e27c91f91 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -13,7 +13,16 @@ jobs: with: python-version: '3.13' - - run: sudo apt-get update && sudo apt-get install -y gettext gobject-introspection libgirepository1.0-dev python3-gi-cairo libcairo2-dev + - 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 - name: Install Python dependencies and setup venv From e4880468ab368feaa95b338dc472dc5fef24562c Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 00:44:08 +0100 Subject: [PATCH 54/97] Log error for SDL renderer errors too --- src/tauon/__main__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tauon/__main__.py b/src/tauon/__main__.py index 7ef6dc412..32491aa8e 100755 --- a/src/tauon/__main__.py +++ b/src/tauon/__main__.py @@ -363,6 +363,7 @@ def transfer_args_and_exit() -> None: if not renderer: logging.error("ERROR CREATING RENDERER!") + logging.error(f"SDL Error: {SDL_GetError()}") sys.exit(1) SDL_SetRenderDrawBlendMode(renderer, SDL_BLENDMODE_BLEND) From a866e6f0596659b3fff1c0daec3b818c14166426 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 00:46:36 +0100 Subject: [PATCH 55/97] Fix up CI --- .github/workflows/build_Linux.yaml | 5 +++-- .github/workflows/build_macOS.yaml | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index e27c91f91..3d4fe437d 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -13,8 +13,9 @@ jobs: with: python-version: '3.13' - - run: \ - sudo apt-get update \ + - name: Install deps + - run: / + sudo apt-get update sudo apt-get install -y \ gettext \ gobject-introspection \ diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index 2eaaec887..6078c2050 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -23,7 +23,20 @@ jobs: run: brew update && brew upgrade - name: Install brew dependencies - run: brew install gobject-introspection gtk+3 pango sdl2 sdl2_image jpeg-xl ffmpeg@5 librsvg opusfile libopenmpt wavpack game-music-emu + run: / + brew install \ + gobject-introspection \ + gtk+3 \ + pango \ + sdl2 \ + sdl2_image \ + jpeg-xl \ + ffmpeg@5 \ + librsvg \ + opusfile \ + libopenmpt \ + wavpack \ + game-music-emu - name: Install Python dependencies and setup venv run: | From edaea451fdeeade82128a264052a30a2e4533ab6 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 00:49:38 +0100 Subject: [PATCH 56/97] Editor is rendering pipes curved here... --- .github/workflows/build_Linux.yaml | 2 +- .github/workflows/build_macOS.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index 3d4fe437d..dd7a74027 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -14,7 +14,7 @@ jobs: python-version: '3.13' - name: Install deps - - run: / + - run: | sudo apt-get update sudo apt-get install -y \ gettext \ diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index 6078c2050..e6059ee7d 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -23,7 +23,7 @@ jobs: run: brew update && brew upgrade - name: Install brew dependencies - run: / + run: | brew install \ gobject-introspection \ gtk+3 \ From ba8e4596257c2281e5c0150c60e52d6b2d7f7026 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 00:53:34 +0100 Subject: [PATCH 57/97] Linux CI: Fix syntax --- .github/workflows/build_Linux.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index dd7a74027..0d75a0070 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -14,7 +14,7 @@ jobs: python-version: '3.13' - name: Install deps - - run: | + run: | sudo apt-get update sudo apt-get install -y \ gettext \ From bfba2cf69f731314d4150ebca7f710c9f8129138 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 00:56:29 +0100 Subject: [PATCH 58/97] Jpeg XL dep --- .github/workflows/build_Linux.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index 0d75a0070..3db81518b 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -23,7 +23,8 @@ jobs: python3-gi-cairo \ libcairo2-dev \ libpipewire-0.3-dev \ - libdbus-1-dev + libdbus-1-dev \ + libjxl-dev - name: Install Python dependencies and setup venv From 3b27972d0f61a6aca4d22904d0c3e126c98420fb Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 00:59:37 +0100 Subject: [PATCH 59/97] Try 24.10 --- .github/workflows/build_Linux.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index 3db81518b..740b50b8b 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -6,7 +6,7 @@ on: jobs: build: - runs-on: ubuntu-24.04 + runs-on: ubuntu-24.10 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 From 86c01dec94c864ba445f4c9048fa02c49f8c52f4 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 14:34:52 +0100 Subject: [PATCH 60/97] Make requirements.txt be the cross-platform full one --- .github/workflows/build_Linux.yaml | 5 +++-- .github/workflows/build_macOS.yaml | 2 +- pyproject.toml | 4 ++-- requirements.txt | 21 +++++++++++++++++++-- requirements_linux.txt | 12 ++++++++++++ requirements_unified.txt | 29 ----------------------------- 6 files changed, 37 insertions(+), 36 deletions(-) create mode 100644 requirements_linux.txt delete mode 100644 requirements_unified.txt diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index 740b50b8b..756da5f66 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -6,13 +6,14 @@ on: jobs: build: - runs-on: ubuntu-24.10 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: '3.13' +# JXL is too old(?) on 24.04 so see you 2026-05 to enable that if we don't switch to Arch first. - name: Install deps run: | sudo apt-get update @@ -33,7 +34,7 @@ jobs: python -m venv .venv source .venv/bin/activate pip install \ - -r requirements_unified.txt + -r requirements.txt build \ pyinstaller diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index e6059ee7d..3966403c3 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -44,7 +44,7 @@ jobs: python -m venv .venv source .venv/bin/activate pip install \ - -r requirements_unified.txt \ + -r requirements.txt \ build \ pyinstaller diff --git a/pyproject.toml b/pyproject.toml index 1f554344c..8a08942d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -107,11 +107,11 @@ ] [tool.setuptools.dynamic] -dependencies = {file = "requirements_unified.txt"} +dependencies = {file = "requirements.txt"} # # Windows ## dependencies = {file = "requirements_windows.txt"} # # Linux -# dependencies = {file = "requirements.txt"} +# dependencies = {file = "requirements_linux.txt"} # # macOS # dependencies = {file = "requirements_macos.txt"} diff --git a/requirements.txt b/requirements.txt index c7e87b862..8a2240e2b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,8 +1,6 @@ beautifulsoup4 -dbus-python musicbrainzngs mutagen -Pillow PlexAPI PyGObject pylast>=3.1.0 @@ -10,3 +8,22 @@ PySDL2 requests Send2Trash unidecode +dbus-python; sys_platform == 'linux' +pysdl2-dll; sys_platform == 'darwin' # Don't rely on system https://github.com/py-sdl/py-sdl2#requirements +comtypes; sys_platform == 'win32' +infi.systray; sys_platform == 'win32' +keyboard; sys_platform == 'win32' +Pillow; sys_platform != 'win32' +opencc; sys_platform != 'win32' # OPTDEP +opencc-python-reimplemented; sys_platform == 'win32' # OPTDEP +pyinstaller # ; sys_platform != 'linux' # for macOS at least +pypresence # optdep +tekore # optdep, +natsort # optdep +jxlpy; sys_platform != 'darwin' # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563 +#librespot - https://github.com/kokarare1212/librespot-python/pull/286 +#picard - picard 2.12.3 requires charset-normalizer~=3.3.2, but you have charset-normalizer 3.4.0 which is incompatible. +PyChromecast # OPTDEP +setproctitle # OPTDEP +tidalapi # OPTDEP +colored_traceback # very opt diff --git a/requirements_linux.txt b/requirements_linux.txt new file mode 100644 index 000000000..c7e87b862 --- /dev/null +++ b/requirements_linux.txt @@ -0,0 +1,12 @@ +beautifulsoup4 +dbus-python +musicbrainzngs +mutagen +Pillow +PlexAPI +PyGObject +pylast>=3.1.0 +PySDL2 +requests +Send2Trash +unidecode diff --git a/requirements_unified.txt b/requirements_unified.txt deleted file mode 100644 index 8a2240e2b..000000000 --- a/requirements_unified.txt +++ /dev/null @@ -1,29 +0,0 @@ -beautifulsoup4 -musicbrainzngs -mutagen -PlexAPI -PyGObject -pylast>=3.1.0 -PySDL2 -requests -Send2Trash -unidecode -dbus-python; sys_platform == 'linux' -pysdl2-dll; sys_platform == 'darwin' # Don't rely on system https://github.com/py-sdl/py-sdl2#requirements -comtypes; sys_platform == 'win32' -infi.systray; sys_platform == 'win32' -keyboard; sys_platform == 'win32' -Pillow; sys_platform != 'win32' -opencc; sys_platform != 'win32' # OPTDEP -opencc-python-reimplemented; sys_platform == 'win32' # OPTDEP -pyinstaller # ; sys_platform != 'linux' # for macOS at least -pypresence # optdep -tekore # optdep, -natsort # optdep -jxlpy; sys_platform != 'darwin' # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563 -#librespot - https://github.com/kokarare1212/librespot-python/pull/286 -#picard - picard 2.12.3 requires charset-normalizer~=3.3.2, but you have charset-normalizer 3.4.0 which is incompatible. -PyChromecast # OPTDEP -setproctitle # OPTDEP -tidalapi # OPTDEP -colored_traceback # very opt From a0a583a082f1e8c5b48e54421bfe46963c3deceb Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 14:43:31 +0100 Subject: [PATCH 61/97] yeet JXLPY to temp pass CI --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8a2240e2b..70ef705af 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,8 @@ pyinstaller # ; sys_platform != 'linux' # for macOS at least pypresence # optdep tekore # optdep, natsort # optdep -jxlpy; sys_platform != 'darwin' # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563 +# TODO(Martin): Ubuntu 24.04 seems to be too old to compile jxlpy, so keep it disabled for now to pass CI +#jxlpy; sys_platform != 'darwin' # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563 #librespot - https://github.com/kokarare1212/librespot-python/pull/286 #picard - picard 2.12.3 requires charset-normalizer~=3.3.2, but you have charset-normalizer 3.4.0 which is incompatible. PyChromecast # OPTDEP From ce04ae1ed4fc8fe5a40e947f1bc85d017c770667 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 15:03:41 +0100 Subject: [PATCH 62/97] Fix backslash --- .github/workflows/build_Linux.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index 756da5f66..c17186b03 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -34,7 +34,7 @@ jobs: python -m venv .venv source .venv/bin/activate pip install \ - -r requirements.txt + -r requirements.txt \ build \ pyinstaller From 5355d91e32d8629508403465030664784d2793b8 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 15:12:39 +0100 Subject: [PATCH 63/97] test if sdl framework still gets copied --- mac.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mac.spec b/mac.spec index 8ce283ec6..b988a5468 100644 --- a/mac.spec +++ b/mac.spec @@ -30,7 +30,7 @@ a = Analysis( ("src/tauon/locale", "locale"), ("src/tauon/theme", "theme"), ("src/tauon/templates", "templates"), - (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2.framework", "."), +# (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2.framework", "."), (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2_image.framework", "."), ], hiddenimports=["sdl2", "phazor", "pylast", "zeroconf"], From e192762052ee45fd4ac084003013be353b921f40 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 15:14:31 +0100 Subject: [PATCH 64/97] Linux CI: Clone submodules too --- .github/workflows/build_Linux.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index c17186b03..3151644dc 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -8,8 +8,13 @@ jobs: build: runs-on: ubuntu-24.04 steps: - - uses: actions/checkout@v4 - - uses: actions/setup-python@v5 + - 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' From e37f533e27f9e03a7518302546330c2f88a86482 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 15:18:19 +0100 Subject: [PATCH 65/97] Linux CI: Add devel packages for audio --- .github/workflows/build_Linux.yaml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index 3151644dc..c6b04d9af 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -30,8 +30,16 @@ jobs: libcairo2-dev \ libpipewire-0.3-dev \ libdbus-1-dev \ - libjxl-dev + libjxl-dev \ + libwavpack-dev \ + libopenmpt-dev \ + libvorbis-dev \ + libopusfile-dev \ + libflac-dev \ + libgme-dev \ + libmpg123-dev +# libsamplerate0-dev \ - name: Install Python dependencies and setup venv run: | From e6e808279bd385227c7e93e6baf85e00bddad61a Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 15:21:29 +0100 Subject: [PATCH 66/97] Linux CI: Add libsamplerate0-dev --- .github/workflows/build_Linux.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index c6b04d9af..76952e863 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -31,15 +31,15 @@ jobs: libpipewire-0.3-dev \ libdbus-1-dev \ libjxl-dev \ - libwavpack-dev \ - libopenmpt-dev \ - libvorbis-dev \ - libopusfile-dev \ libflac-dev \ libgme-dev \ libmpg123-dev + libopenmpt-dev \ + libopusfile-dev \ + libsamplerate0-dev \ + libvorbis-dev \ + libwavpack-dev \ -# libsamplerate0-dev \ - name: Install Python dependencies and setup venv run: | From cede69db22c1ded6fdd853280fa8d18627af04f8 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 15:24:46 +0100 Subject: [PATCH 67/97] Linux CI: Fix backslash --- .github/workflows/build_Linux.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index 76952e863..5e5fd4eea 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -33,13 +33,12 @@ jobs: libjxl-dev \ libflac-dev \ libgme-dev \ - libmpg123-dev + libmpg123-dev \ libopenmpt-dev \ libopusfile-dev \ libsamplerate0-dev \ libvorbis-dev \ - libwavpack-dev \ - + libwavpack-dev - name: Install Python dependencies and setup venv run: | From ebb743a68e2767a1eb0eb98dbf6b52f176e10945 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 15:27:39 +0100 Subject: [PATCH 68/97] Try copying the entire sdl2dll dir --- mac.spec | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mac.spec b/mac.spec index b988a5468..1413b3c29 100644 --- a/mac.spec +++ b/mac.spec @@ -30,8 +30,10 @@ a = Analysis( ("src/tauon/locale", "locale"), ("src/tauon/theme", "theme"), ("src/tauon/templates", "templates"), -# (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2.framework", "."), - (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2_image.framework", "."), + # This should only have SDL2.framework and SDL2_image.framework but it copies it with a __dot__ instead + # So just copy the entire dll dir + (".venv/lib/python3.13/site-packages/sdl2dll/dll", "."), +# (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2_image.framework", "."), ], hiddenimports=["sdl2", "phazor", "pylast", "zeroconf"], hookspath=["extra/pyinstaller-hooks"], From d8a67bab282e25269a3cd6afda3b0af58f040630 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 15:32:24 +0100 Subject: [PATCH 69/97] Rename compile translations job --- .github/workflows/compile_translations.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/compile_translations.yaml b/.github/workflows/compile_translations.yaml index 823a651c5..786ab20e3 100644 --- a/.github/workflows/compile_translations.yaml +++ b/.github/workflows/compile_translations.yaml @@ -1,4 +1,4 @@ -name: Tauon Linux CI +name: Compile translations on Linux on: push: From ecfac75f8d7f49bbefa67d4c6e6bc37ae4ee0a80 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 15:34:50 +0100 Subject: [PATCH 70/97] Try adding zeroconf to reqs --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 70ef705af..bdf924c82 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,3 +28,4 @@ PyChromecast # OPTDEP setproctitle # OPTDEP tidalapi # OPTDEP colored_traceback # very opt +zeroconf # pychromecast dependency, TODO(Martin): This is a test, remove me From 9b6e4acc251a3bcf52fed7b4f6ab64f8987769b4 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 16:38:15 +0100 Subject: [PATCH 71/97] Fix pychromecast on pyinstaller --- linux.spec | 7 ++++++- mac.spec | 8 +++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/linux.spec b/linux.spec index edca3fe15..2b68c0655 100644 --- a/linux.spec +++ b/linux.spec @@ -12,7 +12,12 @@ a = Analysis( # (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2.framework", "."), # (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2_image.framework", "."), ], - hiddenimports=["pylast", "zeroconf"], + hiddenimports=[ + "pylast", + "phazor", + "zeroconf._utils.ipaddress", + "zeroconf._handlers.answers", + ], hookspath=["extra/pyinstaller-hooks"], hooksconfig={}, runtime_hooks=[], diff --git a/mac.spec b/mac.spec index 1413b3c29..d788d50d0 100644 --- a/mac.spec +++ b/mac.spec @@ -35,7 +35,13 @@ a = Analysis( (".venv/lib/python3.13/site-packages/sdl2dll/dll", "."), # (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2_image.framework", "."), ], - hiddenimports=["sdl2", "phazor", "pylast", "zeroconf"], + hiddenimports=[ + "sdl2", + "phazor", + "pylast", + "zeroconf._utils.ipaddress", + "zeroconf._handlers.answers", + ], hookspath=["extra/pyinstaller-hooks"], hooksconfig={}, runtime_hooks=[], From 3054bde26764b841c6536a80b43b8a2100da7eea Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 16:51:48 +0100 Subject: [PATCH 72/97] Fix pyproject.toml indents --- pyproject.toml | 54 +++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 8a08942d9..0a40513c1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -107,7 +107,7 @@ ] [tool.setuptools.dynamic] -dependencies = {file = "requirements.txt"} + dependencies = {file = "requirements.txt"} # # Windows ## dependencies = {file = "requirements_windows.txt"} # # Linux @@ -116,7 +116,7 @@ dependencies = {file = "requirements.txt"} # dependencies = {file = "requirements_macos.txt"} [tool.setuptools.package-data] -"tauon" = ["assets/*", "assets/svg/*", "locale/*/*/*.mo", "templates/*", "theme/*"] + "tauon" = ["assets/*", "assets/svg/*", "locale/*/*/*.mo", "templates/*", "theme/*"] # https://github.com/microsoft/pyright/blob/main/docs/configuration.md#pyright-configuration [tool.pyright] @@ -193,28 +193,28 @@ dependencies = {file = "requirements.txt"} # https://docs.astral.sh/ruff/rules/ [tool.ruff.lint] -select = ['ALL'] - ignore = [ - 'Q003', # avoidable-escaped-quote - It's not that important, we just use escapes, keeping the quotes consistent - 'W191', # tab-indentation - We use tabs for indents, disabling this PEP 8 recommendation - 'D206', # indent-with-spaces - ^ - 'D100', # undocumented-public-module - TODO(Martin): We currently don't even have typing fully implemented, let's maybe care about undocumented functions/classes later - 'D101', # undocumented-public-class - ^ - 'D102', # public-method - ^ - 'D103', # undocumented-public-function - ^ - 'D104', # undocumented-public-package - ^ -# 'D105', # undocumented-magic-method - ^ < This one is a bit more severe though - 'D106', # undocumented-public-nested-class - ^ - 'D107', # undocumented-public-init - ^ - 'D400', # ends-in-period - We do not care if docstrings end with a period - 'D415', # ends-in-punctuation - ^ - 'D401', # non-imperative-mood - Wants docstrings in imperative language but it's really not foolproof, disable - 'EM101', # raw-string-in-exception - We do not care about .format in exceptions, readability is not *our* problem, traceback should be colorized to avoid this instead - 'EM102', # f-string-in-exception - ^ - 'EM103', # dot-format-in-exception - ^ - 'ERA001', # commented-out-code - Tests for commented out code, but it has way too many false positives, so disable - 'FBT001', # boolean-type-hint-positional-argument - Allow positional booleans in functions, it's not really that much of an issue - 'FBT002', # boolean-default-value-positional-argument - ^ - 'FBT003', # boolean-positional-value-in-call - ^ - 'TD003', # missing-todo-link - We're fine not linking existing issues in TODOs, it's fine to have them noted in code only - ] + select = ['ALL'] + ignore = [ + 'Q003', # avoidable-escaped-quote - It's not that important, we just use escapes, keeping the quotes consistent + 'W191', # tab-indentation - We use tabs for indents, disabling this PEP 8 recommendation + 'D206', # indent-with-spaces - ^ + 'D100', # undocumented-public-module - TODO(Martin): We currently don't even have typing fully implemented, let's maybe care about undocumented functions/classes later + 'D101', # undocumented-public-class - ^ + 'D102', # public-method - ^ + 'D103', # undocumented-public-function - ^ + 'D104', # undocumented-public-package - ^ +# 'D105', # undocumented-magic-method - ^ < This one is a bit more severe though + 'D106', # undocumented-public-nested-class - ^ + 'D107', # undocumented-public-init - ^ + 'D400', # ends-in-period - We do not care if docstrings end with a period + 'D415', # ends-in-punctuation - ^ + 'D401', # non-imperative-mood - Wants docstrings in imperative language but it's really not foolproof, disable + 'EM101', # raw-string-in-exception - We do not care about .format in exceptions, readability is not *our* problem, traceback should be colorized to avoid this instead + 'EM102', # f-string-in-exception - ^ + 'EM103', # dot-format-in-exception - ^ + 'ERA001', # commented-out-code - Tests for commented out code, but it has way too many false positives, so disable + 'FBT001', # boolean-type-hint-positional-argument - Allow positional booleans in functions, it's not really that much of an issue + 'FBT002', # boolean-default-value-positional-argument - ^ + 'FBT003', # boolean-positional-value-in-call - ^ + 'TD003', # missing-todo-link - We're fine not linking existing issues in TODOs, it's fine to have them noted in code only + ] From a697f3d1c20ada50ff4001387a3b5b7d5e7c3892 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 16:53:15 +0100 Subject: [PATCH 73/97] Clean up requirements a bit --- requirements.txt | 2 +- requirements_macos.txt | 3 +-- requirements_windows.txt | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/requirements.txt b/requirements.txt index bdf924c82..b545b3bf1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ requests Send2Trash unidecode dbus-python; sys_platform == 'linux' -pysdl2-dll; sys_platform == 'darwin' # Don't rely on system https://github.com/py-sdl/py-sdl2#requirements +pysdl2-dll; sys_platform == 'darwin' # Don't rely on system SDL2 https://github.com/py-sdl/py-sdl2#requirements comtypes; sys_platform == 'win32' infi.systray; sys_platform == 'win32' keyboard; sys_platform == 'win32' diff --git a/requirements_macos.txt b/requirements_macos.txt index 002f6d829..bd174a6f9 100644 --- a/requirements_macos.txt +++ b/requirements_macos.txt @@ -1,12 +1,11 @@ beautifulsoup4 -#dbus-python # Linux dep musicbrainzngs mutagen Pillow PlexAPI PyGObject pylast>=3.1.0 -pysdl2-dll # Don't rely on system https://github.com/py-sdl/py-sdl2#requirements +pysdl2-dll PySDL2 requests Send2Trash diff --git a/requirements_windows.txt b/requirements_windows.txt index 3b8d17270..caac82813 100644 --- a/requirements_windows.txt +++ b/requirements_windows.txt @@ -1,13 +1,11 @@ beautifulsoup4 comtypes # Windows dep -# dbus-python # Linux dep infi.systray keyboard # Windows dep musicbrainzngs mutagen natsort # optdep opencc-python-reimplemented # Windows version of openCC optdep -# Pillow # Linux dep PlexAPI PyGObject pyinstaller From c60ec2965b65dae23d68fd38c0ea2bd4ab68087a Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 16:54:50 +0100 Subject: [PATCH 74/97] Stop always printing pychromecast exception, now just to debug --- src/tauon/t_modules/t_main.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tauon/t_modules/t_main.py b/src/tauon/t_modules/t_main.py index 99cfd1af8..fcdca4368 100644 --- a/src/tauon/t_modules/t_main.py +++ b/src/tauon/t_modules/t_main.py @@ -8997,8 +8997,8 @@ def wake(self) -> None: try: from tauon.t_modules.t_chrome import Chrome -except ModuleNotFoundError: - logging.exception("Test exception DELETE THIS LINE.") +except ModuleNotFoundError as e: + logging.debug("pychromecast import error: {e}") logging.warning("Unable to import Chrome(pychromecast), chromecast support will be disabled.") except Exception: logging.exception("Unknown error trying to import Chrome(pychromecast), chromecast support will be disabled.") From f743516d3cda05fd7aa0651d61129e5f357ac261 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 16:55:25 +0100 Subject: [PATCH 75/97] Move Chrome() creation back to try block --- src/tauon/t_modules/t_main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tauon/t_modules/t_main.py b/src/tauon/t_modules/t_main.py index fcdca4368..32cd0ec09 100644 --- a/src/tauon/t_modules/t_main.py +++ b/src/tauon/t_modules/t_main.py @@ -8997,13 +8997,13 @@ def wake(self) -> None: try: from tauon.t_modules.t_chrome import Chrome + chrome = Chrome(tauon) except ModuleNotFoundError as e: logging.debug("pychromecast import error: {e}") logging.warning("Unable to import Chrome(pychromecast), chromecast support will be disabled.") except Exception: logging.exception("Unknown error trying to import Chrome(pychromecast), chromecast support will be disabled.") finally: - chrome = Chrome(tauon) logging.debug("Found import Chrome(pychromecast) for chromecast support") tauon.chrome = chrome From 7b3be40c95efdb0ed017cfdce84c85f180548a69 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 21:57:36 +0100 Subject: [PATCH 76/97] pysdl fix attempt --- .github/workflows/build_macOS.yaml | 1 + mac.spec | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index 3966403c3..d22bf8d86 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -47,6 +47,7 @@ jobs: -r requirements.txt \ build \ pyinstaller + pip install https://github.com/rokm/pyinstaller/archive/refs/heads/macos-nested-framework-bundles.zip - name: Build the project using python-build run: | diff --git a/mac.spec b/mac.spec index d788d50d0..5e3854be8 100644 --- a/mac.spec +++ b/mac.spec @@ -32,7 +32,7 @@ a = Analysis( ("src/tauon/templates", "templates"), # This should only have SDL2.framework and SDL2_image.framework but it copies it with a __dot__ instead # So just copy the entire dll dir - (".venv/lib/python3.13/site-packages/sdl2dll/dll", "."), + (".venv/lib/python3.13/site-packages/sdl2dll/dll", "sdl2dll/dll"), # (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2_image.framework", "."), ], hiddenimports=[ From a43a39e79b803375a1b17ca5ce97793d462053b2 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 22:39:29 +0100 Subject: [PATCH 77/97] try to switch over to dev pyinstaller better --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index b545b3bf1..4f58be829 100644 --- a/requirements.txt +++ b/requirements.txt @@ -16,7 +16,8 @@ keyboard; sys_platform == 'win32' Pillow; sys_platform != 'win32' opencc; sys_platform != 'win32' # OPTDEP opencc-python-reimplemented; sys_platform == 'win32' # OPTDEP -pyinstaller # ; sys_platform != 'linux' # for macOS at least +#pyinstaller # ; sys_platform != 'linux' # for macOS at least +https://github.com/rokm/pyinstaller/archive/refs/heads/macos-nested-framework-bundles.zip pypresence # optdep tekore # optdep, natsort # optdep From 19bcf497b01a5322c21abe7d12da5d3f12aaf256 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Thu, 19 Dec 2024 22:50:10 +0100 Subject: [PATCH 78/97] Fix up reqs --- .github/workflows/build_macOS.yaml | 6 ++++-- requirements.txt | 1 - 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index d22bf8d86..3dc43aa8d 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -45,9 +45,11 @@ jobs: source .venv/bin/activate pip install \ -r requirements.txt \ - build \ - pyinstaller + build pip install https://github.com/rokm/pyinstaller/archive/refs/heads/macos-nested-framework-bundles.zip +# \ +# pyinstaller +# pip uninstall pyinstaller - name: Build the project using python-build run: | diff --git a/requirements.txt b/requirements.txt index 4f58be829..2568407dc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,7 +17,6 @@ Pillow; sys_platform != 'win32' opencc; sys_platform != 'win32' # OPTDEP opencc-python-reimplemented; sys_platform == 'win32' # OPTDEP #pyinstaller # ; sys_platform != 'linux' # for macOS at least -https://github.com/rokm/pyinstaller/archive/refs/heads/macos-nested-framework-bundles.zip pypresence # optdep tekore # optdep, natsort # optdep From 761fa6997f89d0a4222dab424007becba2488ff2 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 00:47:05 +0100 Subject: [PATCH 79/97] Use pysdl2-dll on all OSs --- linux.spec | 7 +++++-- mac.spec | 6 +++--- requirements.txt | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/linux.spec b/linux.spec index 2b68c0655..7e2cf8c4d 100644 --- a/linux.spec +++ b/linux.spec @@ -9,8 +9,11 @@ a = Analysis( ("src/tauon/locale", "locale"), ("src/tauon/theme", "theme"), ("src/tauon/templates", "templates"), -# (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2.framework", "."), -# (".venv/lib/python3.13/site-packages/sdl2dll/dll/SDL2_image.framework", "."), + # This could only have SDL2.framework and SDL2_image.framework to save space... + (".venv/lib/python3.12/site-packages/sdl2dll/dll", "sdl2dll/dll"), + (".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", diff --git a/mac.spec b/mac.spec index 5e3854be8..2c2fd122e 100644 --- a/mac.spec +++ b/mac.spec @@ -30,10 +30,10 @@ a = Analysis( ("src/tauon/locale", "locale"), ("src/tauon/theme", "theme"), ("src/tauon/templates", "templates"), - # This should only have SDL2.framework and SDL2_image.framework but it copies it with a __dot__ instead - # So just copy the entire dll dir + # 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_image.framework", "."), +# (".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=[ "sdl2", diff --git a/requirements.txt b/requirements.txt index 2568407dc..c32c3b462 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ requests Send2Trash unidecode dbus-python; sys_platform == 'linux' -pysdl2-dll; sys_platform == 'darwin' # Don't rely on system SDL2 https://github.com/py-sdl/py-sdl2#requirements +pysdl2-dll # ; sys_platform == 'darwin' # Don't rely on system SDL2 https://github.com/py-sdl/py-sdl2#requirements comtypes; sys_platform == 'win32' infi.systray; sys_platform == 'win32' keyboard; sys_platform == 'win32' From 338cd94559a7a8646722ba075f6020047d73390b Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 00:57:53 +0100 Subject: [PATCH 80/97] Fix up Linux spec file --- linux.spec | 1 - 1 file changed, 1 deletion(-) diff --git a/linux.spec b/linux.spec index 7e2cf8c4d..a842a73d7 100644 --- a/linux.spec +++ b/linux.spec @@ -10,7 +10,6 @@ a = Analysis( ("src/tauon/theme", "theme"), ("src/tauon/templates", "templates"), # This could only have SDL2.framework and SDL2_image.framework to save space... - (".venv/lib/python3.12/site-packages/sdl2dll/dll", "sdl2dll/dll"), (".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"), From 426207844f43693e9069f30ddbf0d81fa61b09be Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 01:18:26 +0100 Subject: [PATCH 81/97] Try bumping ffmpeg from v5 to v7 --- .github/workflows/build_macOS.yaml | 2 +- mac.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index 3dc43aa8d..1229b63d5 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -31,7 +31,7 @@ jobs: sdl2 \ sdl2_image \ jpeg-xl \ - ffmpeg@5 \ + ffmpeg@7 \ librsvg \ opusfile \ libopenmpt \ diff --git a/mac.spec b/mac.spec index 2c2fd122e..42e7c18ac 100644 --- a/mac.spec +++ b/mac.spec @@ -22,7 +22,7 @@ a = Analysis( binaries=[ *lib_paths, (phazor_path, "."), - (f"{prefix}/Cellar/ffmpeg@5", "."), + (f"{prefix}/Cellar/ffmpeg@7", "."), # ("/usr/lib/girepository-1.0/Rsvg-2.0.typelib", "."), ], datas=[ From 3b97287b24217edf632d445884e2f385fe45d1cc Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 01:24:32 +0100 Subject: [PATCH 82/97] Ffmpeg v2 attempt numero duo --- .github/workflows/build_macOS.yaml | 2 +- mac.spec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index 1229b63d5..931d6cad8 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -31,7 +31,7 @@ jobs: sdl2 \ sdl2_image \ jpeg-xl \ - ffmpeg@7 \ + ffmpeg \ librsvg \ opusfile \ libopenmpt \ diff --git a/mac.spec b/mac.spec index 42e7c18ac..6fc1fb7b7 100644 --- a/mac.spec +++ b/mac.spec @@ -22,7 +22,7 @@ a = Analysis( binaries=[ *lib_paths, (phazor_path, "."), - (f"{prefix}/Cellar/ffmpeg@7", "."), + (f"{prefix}/Cellar/ffmpeg", "."), # ("/usr/lib/girepository-1.0/Rsvg-2.0.typelib", "."), ], datas=[ From f83e1adff0202a3579e905598c7b52605563099e Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 01:54:22 +0100 Subject: [PATCH 83/97] Attempt to add a Rsvg hook --- extra/pyinstaller-hooks/hook-gi.repository.Rsvg.py | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 extra/pyinstaller-hooks/hook-gi.repository.Rsvg.py diff --git a/extra/pyinstaller-hooks/hook-gi.repository.Rsvg.py b/extra/pyinstaller-hooks/hook-gi.repository.Rsvg.py new file mode 100644 index 000000000..7ac85cd35 --- /dev/null +++ b/extra/pyinstaller-hooks/hook-gi.repository.Rsvg.py @@ -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() From 387f72bbdc7370531162eba290ee9240b8655931 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 08:53:03 +0100 Subject: [PATCH 84/97] Indent user files location --- src/tauon/t_modules/t_main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tauon/t_modules/t_main.py b/src/tauon/t_modules/t_main.py index 32cd0ec09..84bc04211 100644 --- a/src/tauon/t_modules/t_main.py +++ b/src/tauon/t_modules/t_main.py @@ -608,7 +608,7 @@ else: logging.info("Running from installed location") - logging.info("User files location: " + user_directory) + logging.info(f" User files location: {user_directory}") if not Path(Path(user_directory) / "encoder").is_dir(): os.makedirs(Path(user_directory) / "encoder") From 1feb331cf33f2bde4f4ea60d07e3f4dd8becb7b2 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 09:55:55 +0100 Subject: [PATCH 85/97] Add toggle console button to Misc --- src/tauon/t_modules/t_main.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/tauon/t_modules/t_main.py b/src/tauon/t_modules/t_main.py index 84bc04211..4b9fb521b 100644 --- a/src/tauon/t_modules/t_main.py +++ b/src/tauon/t_modules/t_main.py @@ -1008,9 +1008,14 @@ def no_padding() -> int: # Variables now go in the gui, pctl, input and prefs class instances. The following just haven't been moved yet class DConsole: + """GUI console with logs""" def __init__(self) -> None: self.show: bool = False + def toggle(self) -> None: + """Toggle the GUI console with logs on and off""" + console.show ^= True + console = DConsole() spot_cache_saved_albums = [] @@ -16940,7 +16945,7 @@ def parse_template(string, track_object: TrackClass, up_ext: bool = False, stric radio_tab_menu = Menu(160, show_icons=True) -def rename_playlist(index, generator=False): +def rename_playlist(index, generator: bool = False) -> None: gui.rename_playlist_box = True rename_playlist_box.edit_generator = False rename_playlist_box.playlist_index = index @@ -16967,7 +16972,7 @@ def rename_playlist(index, generator=False): rename_playlist_box.toggle_edit_gen() -def edit_generator_box(index: int): +def edit_generator_box(index: int) -> None: rename_playlist(index, generator=True) @@ -19145,6 +19150,7 @@ def export_playlist_albums(pl: int) -> None: tab_menu.add_to_sub(2, MenuItem(_("Set as Downloads Playlist"), set_download_playlist, set_download_deco, pass_ref_deco=True, pass_ref=True)) tab_menu.add_to_sub(2, MenuItem(_("Set podcast mode"), set_podcast_playlist, set_podcast_deco, pass_ref_deco=True, pass_ref=True)) tab_menu.add_to_sub(2, MenuItem(_("Remove Duplicates"), remove_duplicates, pass_ref=True)) +tab_menu.add_to_sub(2, MenuItem(_("Toggle Console"), console.toggle)) # tab_menu.add_to_sub("Empty Playlist", 0, new_playlist) @@ -39156,7 +39162,6 @@ def right_remove_item(self) -> None: show_message(_("Looks like it's gone now anyway")) def toggle_pause(self) -> None: - pctl.pause_queue ^= True def draw_card( @@ -43974,7 +43979,7 @@ def drop_file(target): cycle_playlist_pinned(-1) if keymaps.test("toggle-console"): - console.show ^= True + console.toggle() if keymaps.test("toggle-fullscreen"): if not gui.fullscreen and gui.mode != 3: From 97b31f11303489515372b6fb82666d7929793dd5 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 10:00:01 +0100 Subject: [PATCH 86/97] Log PATH when looking for ffmpeg --- src/tauon/t_modules/t_main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tauon/t_modules/t_main.py b/src/tauon/t_modules/t_main.py index 4b9fb521b..c8cc173d9 100644 --- a/src/tauon/t_modules/t_main.py +++ b/src/tauon/t_modules/t_main.py @@ -8942,6 +8942,7 @@ def test_ffmpeg(self) -> bool: return False def get_ffmpeg(self) -> str | None: + logging.debug(f"Looking for ffmpeg in PATH: {os.environ.get('PATH')}") p = shutil.which("ffmpeg") if p: return p From b5458d5a1ec398b3f2c5ccb54f1dd263e1f69e80 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 10:08:46 +0100 Subject: [PATCH 87/97] Add the second part necessary for Rsvg --- .../hook-gi.repository.Rsvg.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 extra/pyinstaller-hooks/pre_safe_import_module/hook-gi.repository.Rsvg.py diff --git a/extra/pyinstaller-hooks/pre_safe_import_module/hook-gi.repository.Rsvg.py b/extra/pyinstaller-hooks/pre_safe_import_module/hook-gi.repository.Rsvg.py new file mode 100644 index 000000000..1eb1d6e33 --- /dev/null +++ b/extra/pyinstaller-hooks/pre_safe_import_module/hook-gi.repository.Rsvg.py @@ -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) From 0212496ed4b3a8f691990ea38c25f400c47ba126 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 10:10:57 +0100 Subject: [PATCH 88/97] Fix up DConsole self reference --- src/tauon/t_modules/t_main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tauon/t_modules/t_main.py b/src/tauon/t_modules/t_main.py index c8cc173d9..c8d5fe62b 100644 --- a/src/tauon/t_modules/t_main.py +++ b/src/tauon/t_modules/t_main.py @@ -1014,7 +1014,7 @@ def __init__(self) -> None: def toggle(self) -> None: """Toggle the GUI console with logs on and off""" - console.show ^= True + self.show ^= True console = DConsole() From 9df8cdbb26d5dcdcd491df8fece50fa07bf50429 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 12:35:50 +0100 Subject: [PATCH 89/97] Fix up optdeps --- requirements_optional.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_optional.txt b/requirements_optional.txt index b742e12cb..222ae36fe 100644 --- a/requirements_optional.txt +++ b/requirements_optional.txt @@ -1,5 +1,5 @@ colored_traceback -#jxlpy # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563 +jxlpy; sys_platform != 'darwin' # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563 #librespot - https://github.com/kokarare1212/librespot-python/pull/286 natsort opencc From 1e60cd80ee58aa46fc5c74f542e74054e86c8225 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 12:46:38 +0100 Subject: [PATCH 90/97] try hacking libjxl on Linux --- .github/workflows/build_Linux.yaml | 9 ++++++++- requirements.txt | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index 5e5fd4eea..003dae405 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -38,7 +38,14 @@ jobs: libopusfile-dev \ libsamplerate0-dev \ libvorbis-dev \ - libwavpack-dev + libwavpack-dev \ + 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 + dpkg -i *.deb - name: Install Python dependencies and setup venv run: | diff --git a/requirements.txt b/requirements.txt index c32c3b462..1fd868c61 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ requests Send2Trash unidecode dbus-python; sys_platform == 'linux' -pysdl2-dll # ; sys_platform == 'darwin' # Don't rely on system SDL2 https://github.com/py-sdl/py-sdl2#requirements +pysdl2-dll # Don't rely on system SDL2 https://github.com/py-sdl/py-sdl2#requirements comtypes; sys_platform == 'win32' infi.systray; sys_platform == 'win32' keyboard; sys_platform == 'win32' @@ -21,7 +21,7 @@ pypresence # optdep tekore # optdep, natsort # optdep # TODO(Martin): Ubuntu 24.04 seems to be too old to compile jxlpy, so keep it disabled for now to pass CI -#jxlpy; sys_platform != 'darwin' # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563 +jxlpy; sys_platform != 'darwin' # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563 #librespot - https://github.com/kokarare1212/librespot-python/pull/286 #picard - picard 2.12.3 requires charset-normalizer~=3.3.2, but you have charset-normalizer 3.4.0 which is incompatible. PyChromecast # OPTDEP From 40669f9b65e138b2f83444326f868a682faf4ea4 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 12:51:48 +0100 Subject: [PATCH 91/97] Cleanup and document workarounds --- .github/workflows/build_macOS.yaml | 11 +++-------- linux.spec | 1 + mac.spec | 3 ++- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_macOS.yaml b/.github/workflows/build_macOS.yaml index 931d6cad8..7560ab313 100644 --- a/.github/workflows/build_macOS.yaml +++ b/.github/workflows/build_macOS.yaml @@ -46,27 +46,24 @@ jobs: 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 -# env: -# CFLAGS: "-I/opt/homebrew/include" -# LDFLAGS: "-L/opt/homebrew/lib" - name: Install the project into a venv run: | source .venv/bin/activate pip install --prefix ".venv" dist/*.whl -# env: -# CFLAGS: "-I/opt/homebrew/include" -# LDFLAGS: "-L/opt/homebrew/lib" - name: "[DEBUG] List all files" run: find . @@ -77,8 +74,6 @@ jobs: pyinstaller --log-level=DEBUG mac.spec env: DYLD_LIBRARY_PATH: "/opt/homebrew/lib" -# CFLAGS: "-I/opt/homebrew/include" -# LDFLAGS: "-L/opt/homebrew/lib" - name: "[DEBUG] List all files in .app" run: find "dist/TauonMusicBox.app" diff --git a/linux.spec b/linux.spec index a842a73d7..06dce2d31 100644 --- a/linux.spec +++ b/linux.spec @@ -17,6 +17,7 @@ a = Analysis( 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", ], diff --git a/mac.spec b/mac.spec index 6fc1fb7b7..415cc2029 100644 --- a/mac.spec +++ b/mac.spec @@ -23,7 +23,6 @@ a = Analysis( *lib_paths, (phazor_path, "."), (f"{prefix}/Cellar/ffmpeg", "."), -# ("/usr/lib/girepository-1.0/Rsvg-2.0.typelib", "."), ], datas=[ ("src/tauon/assets", "assets"), @@ -39,9 +38,11 @@ a = Analysis( "sdl2", "phazor", "pylast", + # Zeroconf is hacked until this issue is resolved: https://github.com/pyinstaller/pyinstaller-hooks-contrib/issues/840 "zeroconf._utils.ipaddress", "zeroconf._handlers.answers", ], + # TODO(Martin): Rsvg hooks are a hack until pyinstaller releases something newer than 6.11.1 - https://github.com/pyinstaller/pyinstaller/releases hookspath=["extra/pyinstaller-hooks"], hooksconfig={}, runtime_hooks=[], From bd71c3613667a5e4dd3887748e2c9b8ee5cf4adc Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 12:52:31 +0100 Subject: [PATCH 92/97] Fix dpkg -i --- .github/workflows/build_Linux.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index 003dae405..df3da9fb7 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -45,7 +45,7 @@ jobs: 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 - dpkg -i *.deb + sudo dpkg -i *.deb - name: Install Python dependencies and setup venv run: | From 055488ec8e3d9920131d498a37d06718e61cefca Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 12:54:48 +0100 Subject: [PATCH 93/97] Add libgif dep for jxl --- .github/workflows/build_Linux.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index df3da9fb7..7198f6b0e 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -38,7 +38,10 @@ jobs: libopusfile-dev \ libsamplerate0-dev \ libvorbis-dev \ - libwavpack-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 From 79f6f968f57c9f5118ad8adedb0c25009d45ca85 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 12:59:54 +0100 Subject: [PATCH 94/97] Cleanup TODO notes --- .github/workflows/build_Linux.yaml | 1 - requirements.txt | 1 - 2 files changed, 2 deletions(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index 7198f6b0e..df3a23ea6 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -18,7 +18,6 @@ jobs: with: python-version: '3.13' -# JXL is too old(?) on 24.04 so see you 2026-05 to enable that if we don't switch to Arch first. - name: Install deps run: | sudo apt-get update diff --git a/requirements.txt b/requirements.txt index 1fd868c61..333c79370 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,7 +20,6 @@ opencc-python-reimplemented; sys_platform == 'win32' # OPTDEP pypresence # optdep tekore # optdep, natsort # optdep -# TODO(Martin): Ubuntu 24.04 seems to be too old to compile jxlpy, so keep it disabled for now to pass CI jxlpy; sys_platform != 'darwin' # macOS hates it - fails to find jxl/types.h - https://github.com/olokelo/jxlpy/issues/25#issuecomment-2547928563 #librespot - https://github.com/kokarare1212/librespot-python/pull/286 #picard - picard 2.12.3 requires charset-normalizer~=3.3.2, but you have charset-normalizer 3.4.0 which is incompatible. From 21a0ea897f50b7a36a8d539cc0c75df2643e3401 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 13:12:12 +0100 Subject: [PATCH 95/97] Try packaging ffmpeg better --- mac.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mac.spec b/mac.spec index 415cc2029..db7a19bed 100644 --- a/mac.spec +++ b/mac.spec @@ -3,6 +3,8 @@ import subprocess block_cipher = None +# default PATH=/usr/bin:/bin:/usr/sbin:/sbin:/Applications/TauonMusicBox.app/Contents/Frameworks + # Should resolve as /opt/homebrew prefix = subprocess.run(["brew", "--prefix"], capture_output=True, text=True).stdout.strip() @@ -22,7 +24,8 @@ a = Analysis( binaries=[ *lib_paths, (phazor_path, "."), - (f"{prefix}/Cellar/ffmpeg", "."), +# (f"{prefix}/Cellar/ffmpeg", "."), + (f"{prefix}/bin/ffmpeg", "."), ], datas=[ ("src/tauon/assets", "assets"), From 963ede86f1ad61976dd5d3a6252b47ae3a06b754 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 13:28:12 +0100 Subject: [PATCH 96/97] Cleanup docs --- mac.spec | 3 --- pyproject.toml | 8 ++------ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/mac.spec b/mac.spec index db7a19bed..fe590d251 100644 --- a/mac.spec +++ b/mac.spec @@ -24,7 +24,6 @@ a = Analysis( binaries=[ *lib_paths, (phazor_path, "."), -# (f"{prefix}/Cellar/ffmpeg", "."), (f"{prefix}/bin/ffmpeg", "."), ], datas=[ @@ -96,8 +95,6 @@ app = BUNDLE( "LSEnvironment": { "LANG": "en_US.UTF-8", "LC_CTYPE": "en_US.UTF-8", - # Set DYLD_LIBRARY_PATH to ensure the app can locate dynamic libraries -# "DYLD_LIBRARY_PATH": f"{prefix}/lib", }}) for lib in lib_paths: diff --git a/pyproject.toml b/pyproject.toml index 0a40513c1..dba58dd22 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,6 +88,8 @@ # Linux + macOS ext-modules = [ {name = "phazor", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus", "/opt/homebrew/include/opus", "/opt/homebrew/include"], libraries = ["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme"], library-dirs = ["/opt/homebrew/lib"] }, + # Set as optional to allow soft-failure, it's expected not to build on Windows/macOS, but we don't want to fail the entire build on it + # I have not found a better way to solve this, ideally we would somehow tag this as Linux-exclusive {name = "phazor-pw", sources = ["src/phazor/kissfft/kiss_fftr.c", "src/phazor/kissfft/kiss_fft.c", "src/phazor/phazor.c"], include-dirs = ["/usr/include/opus"], libraries = ["samplerate", "wavpack", "opusfile", "vorbisfile", "mpg123", "FLAC", "openmpt", "gme", "pipewire-0.3"], optional = true }, ] @@ -108,12 +110,6 @@ [tool.setuptools.dynamic] dependencies = {file = "requirements.txt"} -# # Windows -## dependencies = {file = "requirements_windows.txt"} -# # Linux -# dependencies = {file = "requirements_linux.txt"} -# # macOS -# dependencies = {file = "requirements_macos.txt"} [tool.setuptools.package-data] "tauon" = ["assets/*", "assets/svg/*", "locale/*/*/*.mo", "templates/*", "theme/*"] From fd32d569c4d1567ff56ac77362cb384c6f6c4263 Mon Sep 17 00:00:00 2001 From: Martin Rys Date: Fri, 20 Dec 2024 13:45:32 +0100 Subject: [PATCH 97/97] Fix up action names --- .github/workflows/build_Linux.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_Linux.yaml b/.github/workflows/build_Linux.yaml index df3a23ea6..56bcc68ab 100644 --- a/.github/workflows/build_Linux.yaml +++ b/.github/workflows/build_Linux.yaml @@ -78,17 +78,17 @@ jobs: source .venv/bin/activate pyinstaller --log-level=DEBUG linux.spec - - name: Create DMG + - name: Create ZIP run: | - mkdir -p dist/dmg + mkdir -p dist/zip APP_NAME="TauonMusicBox" APP_PATH="dist/${APP_NAME}" - ZIP_PATH="dist/dmg/${APP_NAME}.zip" + ZIP_PATH="dist/zip/${APP_NAME}.zip" zip -r "${ZIP_PATH}" "${APP_PATH}" - - name: Upload DMG artifact + - name: Upload ZIP artifact uses: actions/upload-artifact@v4 with: name: TauonMusicBox-linux - path: dist/dmg/TauonMusicBox.zip + path: dist/zip/TauonMusicBox.zip