""" WiX MSI Build-Skript für DocuMentor (WiX v6) Erstellt einen MSI-Installer aus dem PyInstaller Build. """ import subprocess import sys from pathlib import Path 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) print(f"DocuMentor Build gefunden: {dist_dir}") 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...") result = subprocess.run(["wix", "build", "DocuMentor.wxs", "ProductFiles.wxs", "-o", "DocuMentor.msi"], check=False) if result.returncode != 0: print("\nFEHLER: MSI-Kompilierung fehlgeschlagen!") print("Stelle sicher, dass WiX v6 installiert ist:") print(" dotnet tool install --global wix") sys.exit(1) print() print("[OK] MSI erfolgreich erstellt: DocuMentor.msi") print() print("Installation testen mit:") print(" msiexec /i DocuMentor.msi") if __name__ == "__main__": build_msi()