diff options
| author | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-03-13 07:59:40 -0500 |
|---|---|---|
| committer | SulfurNitride <SulfurNitride@users.noreply.github.com> | 2026-03-13 07:59:40 -0500 |
| commit | 9c029108da47412643c189c61e0e7a909bbdaa45 (patch) | |
| tree | f512cfe4d9ca7c030ce7fdf54e48c9cf209ee32f | |
| parent | de4db79e5158017c002cc91c14fa9e58420e7774 (diff) | |
Fix DDS and winreg missing in Python plugins
- Stage DDS/ package from source directly to plugins/data/DDS/ in
build-inner.sh (cmake MO2_STAGE_PYTHON_PLUGIN_PAYLOAD is OFF by
default so the cmake-sourced path was silently skipped)
- Stage winreg.py from libs/ directly as well (same root cause)
- Guard `import winreg` in gog_utils.py with try/except ImportError
and early-exit to Heroic GOG path if the shim is unavailable
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| -rwxr-xr-x | docker/build-inner.sh | 10 | ||||
| -rw-r--r-- | libs/basic_games/gog_utils.py | 10 |
2 files changed, 17 insertions, 3 deletions
diff --git a/docker/build-inner.sh b/docker/build-inner.sh index 3290069..66dadf6 100755 --- a/docker/build-inner.sh +++ b/docker/build-inner.sh @@ -78,8 +78,9 @@ if [ -d "build/src/src/plugins/libs" ]; then mkdir -p "${OUT_DIR}/plugins/libs" cp -f build/src/src/plugins/libs/mobase*.so "${OUT_DIR}/plugins/libs/" 2>/dev/null || true fi -# Python helper shims +# Python helper shims — copy from source directly (cmake staging is OFF by default) for f in lzokay.py winreg.py pyCfg.py; do + [ -f "libs/${f}" ] && cp -f "libs/${f}" "${OUT_DIR}/plugins/" [ -f "build/src/src/plugins/${f}" ] && cp -f "build/src/src/plugins/${f}" "${OUT_DIR}/plugins/" done @@ -103,7 +104,12 @@ if [ -d "libs/basic_games" ]; then -o -name "CMakeLists.txt" -o -name "CMakePresets.json" \) \ -delete 2>/dev/null || true fi -# data/ dir (DDS headers etc., used by native plugins too). +# data/ dir (DDS headers etc., used by DDSPreview.py via plugins/data/ in sys.path). +# Stage DDS package from source directly (cmake staging is OFF by default). +if [ -d "libs/preview_dds/src/DDS" ]; then + mkdir -p "${OUT_DIR}/plugins/data" + cp -a "libs/preview_dds/src/DDS" "${OUT_DIR}/plugins/data/DDS" +fi [ -d "build/src/src/plugins/data" ] && cp -a "build/src/src/plugins/data" "${OUT_DIR}/plugins/" # ── Stylesheets (themes) ── diff --git a/libs/basic_games/gog_utils.py b/libs/basic_games/gog_utils.py index de66ec2..750f739 100644 --- a/libs/basic_games/gog_utils.py +++ b/libs/basic_games/gog_utils.py @@ -5,9 +5,13 @@ from __future__ import annotations import json import sys -import winreg from pathlib import Path +try: + import winreg +except ImportError: + winreg = None # type: ignore[assignment] + def _find_heroic_gog_games() -> dict[str, Path]: """Detect GOG games installed via Heroic Launcher on Linux.""" @@ -44,6 +48,10 @@ def _find_heroic_gog_games() -> dict[str, Path]: def find_games() -> dict[str, Path]: + if winreg is None: + # winreg not available (Linux without shim); use Heroic GOG. + return _find_heroic_gog_games() + # List the game IDs from the registry (Windows): game_ids: list[str] = [] try: |
