Version 1.6.6: Versionsanzeige im Info-Dialog bei PyInstaller-Bundle gefixt

Im PyInstaller-Bundle fehlten .dist-info-Metadaten, wodurch importlib.metadata
keine Paketversionen liefern konnte. Lösung: DocuMentor.spec erzeugt beim Build
einen Versions-Snapshot (versions.json) der ins Bundle eingebettet wird.
license_parser.py liest diesen Snapshot im Bundle-Modus statt importlib.metadata.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-24 13:54:27 +02:00
parent 19f7deec20
commit bf2db92040
7 changed files with 49 additions and 6 deletions
+20
View File
@@ -4,7 +4,10 @@ PyInstaller Konfiguration für DocuMentor
Erstellt eine eigenständige Windows-Executable ohne Python-Installation
"""
import json
import sys
from importlib.metadata import PackageNotFoundError
from importlib.metadata import version as pkg_version
from pathlib import Path
from PyInstaller.utils.hooks import collect_all
@@ -14,6 +17,22 @@ block_cipher = None
project_root = Path(SPECPATH)
src_path = project_root / 'src'
# Versions-Snapshot erzeugen und ins Bundle einbetten
_packages_to_snapshot = [
"PySide6", "pydantic", "pydantic-settings", "pydantic-yaml",
"polars", "connectorx", "pyarrow", "psutil", "lxml",
"ruff", "pyinstaller", "pillow",
]
_versions_snapshot: dict[str, str] = {}
for _pkg in _packages_to_snapshot:
try:
_versions_snapshot[_pkg.lower()] = pkg_version(_pkg)
except PackageNotFoundError:
_versions_snapshot[_pkg.lower()] = ""
_versions_file = project_root / "versions.json"
_versions_file.write_text(json.dumps(_versions_snapshot), encoding="utf-8")
# connectorx komplett sammeln (Python-Code, native .pyd und Metadaten)
# PyInstaller erkennt connectorx nicht automatisch, da es zur Laufzeit
# von polars per importlib.import_module() geladen wird
@@ -36,6 +55,7 @@ a = Analysis(
datas=ui_files + res_files + cx_datas + [
(str(project_root / 'pyproject.toml'), '.'),
(str(project_root / 'THIRD_PARTY_LICENSES.txt'), '.'),
(str(_versions_file), '.'),
(str(project_root / 'resources' / 'icon.ico'), 'resources'),
],
hiddenimports=[