Fix: PyInstaller-Bundle für installierte Version repariert (connectorx, SQL-Ressourcen)

- connectorx via collect_all() eingebunden statt hiddenimports (Rust-PYD + __init__.py + Metadaten als Einheit)
- SQL/CSV-Ressourcen (src/res/) ins PyInstaller-Bundle aufgenommen
- Pfadauflösung in database.py auf sys._MEIPASS umgestellt für installierten Modus
- connectorx als explizite Abhängigkeit in pyproject.toml ergänzt
- Dokumentation (windows_distribution.md) um collect_all-Pattern und _MEIPASS-Hinweise erweitert
- Version auf 1.0.0 aktualisiert, Hersteller-Informationen ergänzt
This commit is contained in:
2026-02-15 19:51:58 +01:00
parent ec33a5b586
commit affba2a9ca
7 changed files with 100 additions and 54 deletions
+7 -1
View File
@@ -5,6 +5,7 @@ Dieses Mixin enthält alle Methoden zur PostgreSQL-Datenbankanbindung
und Datenverarbeitung für das MainWindow.
"""
import sys
import time
import logging
from pathlib import Path
@@ -162,7 +163,12 @@ class DatabaseMixin:
tuple[str, str]|tuple[None, None]: (sql_query, connection_string) oder (None, None) bei Fehler
"""
try:
sql_file_path = Path("src/res/data.sql")
# PyInstaller entpackt Ressourcen nach sys._MEIPASS;
# im Entwicklungsmodus liegt die Datei relativ zum Repo-Root
if hasattr(sys, "_MEIPASS"):
sql_file_path = Path(sys._MEIPASS) / "res" / "data.sql" # type: ignore[attr-defined]
else:
sql_file_path = Path(__file__).parents[3] / "src" / "res" / "data.sql"
if not sql_file_path.exists():
QMessageBox.critical(self, "Fehler", f"SQL-Datei nicht gefunden: {sql_file_path}")
return None, None