fix: binaire Windows crashait au lancement (Qt platform plugin manquant)

Le hook PyQt6 de pyinstaller-hooks-contrib échoue silencieusement à
localiser Qt6/plugins/platforms quand PyInstaller tourne sous Wine,
donc qwindows.dll n'était jamais embarqué dans l'exe. Résultat :
"This application failed to start because no Qt platform plugin
could be initialized" au premier lancement sur Windows.

On force désormais l'ajout des dossiers platforms/ et styles/ via
--add-data, avec un contrôle préalable que qwindows.dll existe bien
côté Wine.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
tuxgyver
2026-08-31 12:05:11 +02:00
co-authored by Claude Sonnet 5
parent c2ac02ee7b
commit 790d302645
+12
View File
@@ -75,16 +75,28 @@ linux: install icon
@echo "" @echo ""
# ── Binaire Windows (via Wine + Python Windows) ────────────────────────────── # ── Binaire Windows (via Wine + Python Windows) ──────────────────────────────
# Le hook PyQt6 de pyinstaller-hooks-contrib introspecte QLibraryInfo pour
# localiser Qt6/plugins/platforms au moment du build : sous Wine cette
# introspection échoue silencieusement, donc qwindows.dll n'est jamais copié
# et l'exe plante au lancement avec « no Qt platform plugin could be
# initialized ». On force sa copie via --add-data.
WINE_QT_PLUGINS := $(HOME)/.wine/drive_c/users/$(USER)/AppData/Local/Programs/Python/Python311/Lib/site-packages/PyQt6/Qt6/plugins
windows: icon windows: icon
@echo "" @echo ""
@echo " 🪟 Compilation Windows (Wine + PyInstaller)" @echo " 🪟 Compilation Windows (Wine + PyInstaller)"
@echo "" @echo ""
@which wine > /dev/null 2>&1 \ @which wine > /dev/null 2>&1 \
|| (echo " Wine non installé sudo apt install wine"; exit 1) || (echo " Wine non installé sudo apt install wine"; exit 1)
@test -f "$(WINE_QT_PLUGINS)/platforms/qwindows.dll" \
|| (echo " qwindows.dll introuvable dans $(WINE_QT_PLUGINS)/platforms"; \
echo " → Installez PyQt6 dans Wine avec : make setup-wine"; exit 1)
@wine $(WINE_PYTHON) -m PyInstaller $(PI_OPTS) \ @wine $(WINE_PYTHON) -m PyInstaller $(PI_OPTS) \
--onefile \ --onefile \
--windowed \ --windowed \
--icon=$(ICON) \ --icon=$(ICON) \
--add-data "$(WINE_QT_PLUGINS)/platforms;PyQt6/Qt6/plugins/platforms" \
--add-data "$(WINE_QT_PLUGINS)/styles;PyQt6/Qt6/plugins/styles" \
$(SRC) \ $(SRC) \
|| (echo ""; \ || (echo ""; \
echo " ❌ Échec : Python Windows introuvable dans Wine."; \ echo " ❌ Échec : Python Windows introuvable dans Wine."; \