2026-01-18 19:01:05 +01:00
|
|
|
"""
|
|
|
|
|
WiX MSI Build-Skript für DocuMentor (WiX v6)
|
|
|
|
|
|
|
|
|
|
Erstellt einen MSI-Installer aus dem PyInstaller Build.
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
import subprocess
|
|
|
|
|
import sys
|
2026-04-04 17:23:12 +02:00
|
|
|
import tomllib
|
2026-01-18 19:01:05 +01:00
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
|
|
|
2026-04-04 17:23:12 +02:00
|
|
|
def get_version(project_root: Path) -> str:
|
|
|
|
|
"""Liest die Versionsnummer aus pyproject.toml."""
|
|
|
|
|
pyproject_path = project_root / "pyproject.toml"
|
|
|
|
|
with pyproject_path.open("rb") as f:
|
|
|
|
|
data = tomllib.load(f)
|
|
|
|
|
return data["project"]["version"]
|
|
|
|
|
|
|
|
|
|
|
2026-01-18 19:01:05 +01:00
|
|
|
def build_msi():
|
|
|
|
|
"""Erstellt MSI-Installer mit WiX v6."""
|
|
|
|
|
project_root = Path(__file__).parent
|
|
|
|
|
dist_dir = project_root / "dist" / "DocuMentor"
|
|
|
|
|
|
|
|
|
|
if not dist_dir.exists():
|
|
|
|
|
print("FEHLER: PyInstaller Build nicht gefunden!")
|
|
|
|
|
print("Bitte zuerst ausführen: uv run python build_windows.py")
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
2026-04-04 17:23:12 +02:00
|
|
|
version = get_version(project_root)
|
|
|
|
|
msi_output = project_root / "dist" / f"DocuMentor-{version}.msi"
|
|
|
|
|
|
2026-01-18 19:01:05 +01:00
|
|
|
print(f"DocuMentor Build gefunden: {dist_dir}")
|
2026-04-04 17:23:12 +02:00
|
|
|
print(f"Version: {version}")
|
|
|
|
|
print(f"MSI-Ausgabe: {msi_output}")
|
2026-01-18 19:01:05 +01:00
|
|
|
print()
|
|
|
|
|
|
|
|
|
|
# Schritt 1: ProductFiles.wxs generieren (ersetzt WiX heat)
|
|
|
|
|
print("Schritt 1/2: Generiere ProductFiles.wxs...")
|
|
|
|
|
result = subprocess.run(["uv", "run", "python", "generate_wix_files.py"], check=False)
|
|
|
|
|
|
|
|
|
|
if result.returncode != 0:
|
|
|
|
|
print("\nFEHLER: ProductFiles.wxs Generierung fehlgeschlagen!")
|
|
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
print()
|
|
|
|
|
|
|
|
|
|
# Schritt 2: MSI kompilieren mit WiX v6
|
|
|
|
|
print("Schritt 2/2: Kompiliere MSI-Installer...")
|
2026-04-04 17:23:12 +02:00
|
|
|
result = subprocess.run(
|
|
|
|
|
["wix", "build", "DocuMentor.wxs", "ProductFiles.wxs", "-o", str(msi_output)],
|
|
|
|
|
check=False,
|
|
|
|
|
)
|
2026-01-18 19:01:05 +01:00
|
|
|
|
|
|
|
|
if result.returncode != 0:
|
|
|
|
|
print("\nFEHLER: MSI-Kompilierung fehlgeschlagen!")
|
|
|
|
|
print("Stelle sicher, dass WiX v6 installiert ist:")
|
2026-04-25 16:12:16 +02:00
|
|
|
print(" dotnet tool install --global wix --version 6.*")
|
2026-01-18 19:01:05 +01:00
|
|
|
sys.exit(1)
|
|
|
|
|
|
|
|
|
|
print()
|
2026-04-04 17:23:12 +02:00
|
|
|
print(f"[OK] MSI erfolgreich erstellt: {msi_output}")
|
2026-01-18 19:01:05 +01:00
|
|
|
print()
|
|
|
|
|
print("Installation testen mit:")
|
2026-04-04 17:23:12 +02:00
|
|
|
print(f" msiexec /i \"{msi_output}\"")
|
2026-01-18 19:01:05 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
build_msi()
|