bb7cad9204
Implementiert ein professionelles Build-System für Windows-Benutzer ohne Python-Installation: PyInstaller-Integration: - DocuMentor.spec mit automatischer Icon/Version-Einbindung - Unterstützung für alle PySide6-UI-Dateien und Dependencies - UPX-Kompression für kleinere Executable-Größe Icon-System: - create_icon.py generiert Standard-Icon oder konvertiert PNG zu ICO - Multi-Size ICO (16x16 bis 256x256) für alle Windows-Kontexte - Automatische Integration in Build-Prozess - Prompts für Bild-KIs (Gemini, DALL-E, etc.) Versionsinformationen: - create_version_info.py liest Version aus pyproject.toml - Windows-Datei-Eigenschaften (Rechtsklick → Details) - Automatische Generierung bei jedem Build Build-Automatisierung: - build_windows.py orchestriert gesamten Build-Prozess - Erstellt Icon und Versionsinformationen automatisch - Generiert ZIP-Archiv für Distribution - Cleanup alter Builds Inno Setup-Integration: - installer.iss für professionelle Setup.exe - GUID-Generator (generate_guid.py) - Desktop-Verknüpfungen und Start-Menü-Integration Dokumentation: - BUILD.md - Schnellstart-Anleitung - docs/windows_distribution.md - Detaillierte Distribution-Dokumentation - docs/icon_and_version_info.md - Icon- und Versions-System - resources/icon_prompt.md - KI-Prompts für Icon-Generierung Dependencies: - pyinstaller>=6.0.0 für Executable-Erstellung - pillow>=10.0.0 für Icon-Generierung Externe Abhängigkeiten (Java, FOP, Saxon, diff-pdf) bleiben separat installierbar. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
142 lines
4.5 KiB
Python
142 lines
4.5 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Build-Skript für Windows-Distribution von DocuMentor
|
|
|
|
Erstellt:
|
|
1. Eigenständige Executable mit PyInstaller
|
|
2. Optional: ZIP-Archiv für portable Distribution
|
|
"""
|
|
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
from pathlib import Path
|
|
from datetime import datetime
|
|
|
|
def main():
|
|
project_root = Path(__file__).parent
|
|
dist_dir = project_root / "dist"
|
|
build_dir = project_root / "build"
|
|
resources_dir = project_root / "resources"
|
|
icon_path = resources_dir / "icon.ico"
|
|
version_info_path = project_root / "version_info.txt"
|
|
|
|
print("=" * 60)
|
|
print("DocuMentor Windows Build")
|
|
print("=" * 60)
|
|
|
|
# 1. Icon und Versionsinformationen generieren
|
|
print("\n[1/6] Icon und Versionsinformationen generieren...")
|
|
|
|
# Icon erstellen falls nicht vorhanden
|
|
if not icon_path.exists():
|
|
print(" Erstelle Standard-Icon...")
|
|
try:
|
|
subprocess.run([sys.executable, "create_icon.py"], check=True, cwd=project_root)
|
|
print(" ✓ Icon erstellt")
|
|
except subprocess.CalledProcessError as e:
|
|
print(f" ✗ Icon-Erstellung fehlgeschlagen: {e}")
|
|
print(" ⚠ Fahre ohne Icon fort...")
|
|
else:
|
|
print(f" ✓ Icon vorhanden: {icon_path.name}")
|
|
|
|
# Versionsinformationen erstellen
|
|
print(" Erstelle Versionsinformationen...")
|
|
try:
|
|
subprocess.run([sys.executable, "create_version_info.py"], check=True, cwd=project_root)
|
|
print(" ✓ Versionsinformationen erstellt")
|
|
except subprocess.CalledProcessError as e:
|
|
print(f" ✗ Versionsinformationen-Erstellung fehlgeschlagen: {e}")
|
|
print(" ⚠ Fahre ohne Versionsinformationen fort...")
|
|
|
|
# 2. Cleanup alter Builds
|
|
print("\n[2/6] Cleanup alter Builds...")
|
|
if dist_dir.exists():
|
|
shutil.rmtree(dist_dir)
|
|
print(" ✓ dist/ gelöscht")
|
|
if build_dir.exists():
|
|
shutil.rmtree(build_dir)
|
|
print(" ✓ build/ gelöscht")
|
|
|
|
# 3. PyInstaller ausführen
|
|
print("\n[3/6] PyInstaller Build starten...")
|
|
try:
|
|
subprocess.run(
|
|
["pyinstaller", "--clean", "DocuMentor.spec"],
|
|
check=True,
|
|
cwd=project_root
|
|
)
|
|
print(" ✓ Build erfolgreich")
|
|
except subprocess.CalledProcessError as e:
|
|
print(f" ✗ Build fehlgeschlagen: {e}")
|
|
return 1
|
|
|
|
# 4. README für Distribution erstellen
|
|
print("\n[4/6] README erstellen...")
|
|
readme_content = """DocuMentor - XSL-Transformations-Verwaltung
|
|
============================================
|
|
|
|
Installation:
|
|
1. Entpacken Sie dieses Archiv in ein Verzeichnis Ihrer Wahl
|
|
2. Führen Sie DocuMentor.exe aus
|
|
|
|
Externe Abhängigkeiten (separat zu installieren):
|
|
- Java Runtime Environment (JRE) oder JDK
|
|
- Apache FOP (für PDF-Generierung)
|
|
- Saxon XSLT-Prozessor (JAR-Datei)
|
|
- diff-pdf (für PDF-Vergleiche)
|
|
|
|
Beim ersten Start werden Sie aufgefordert, die Pfade zu diesen
|
|
Tools in den Programmeinstellungen zu konfigurieren.
|
|
|
|
Konfiguration und Logs:
|
|
- Windows: %APPDATA%\\DocuMentor\\
|
|
- Konfiguration: config.json
|
|
- Logs: logs\\
|
|
|
|
Support:
|
|
Bei Fragen oder Problemen erstellen Sie bitte ein Issue auf GitHub.
|
|
"""
|
|
|
|
readme_path = dist_dir / "DocuMentor" / "README.txt"
|
|
readme_path.write_text(readme_content, encoding='utf-8')
|
|
print(" ✓ README.txt erstellt")
|
|
|
|
# 5. Icon ins dist-Verzeichnis kopieren (für Installer)
|
|
print("\n[5/6] Icon für Installer vorbereiten...")
|
|
if icon_path.exists():
|
|
dist_icon = dist_dir / "DocuMentor" / "icon.ico"
|
|
shutil.copy2(icon_path, dist_icon)
|
|
print(" ✓ Icon kopiert")
|
|
else:
|
|
print(" ⚠ Kein Icon vorhanden")
|
|
|
|
# 6. ZIP-Archiv erstellen
|
|
print("\n[6/6] ZIP-Archiv erstellen...")
|
|
timestamp = datetime.now().strftime("%Y%m%d")
|
|
zip_name = f"DocuMentor-{timestamp}-Windows"
|
|
zip_path = dist_dir / zip_name
|
|
|
|
shutil.make_archive(
|
|
str(zip_path),
|
|
'zip',
|
|
dist_dir,
|
|
'DocuMentor'
|
|
)
|
|
print(f" ✓ {zip_name}.zip erstellt")
|
|
|
|
print("\n" + "=" * 60)
|
|
print("Build abgeschlossen!")
|
|
print("=" * 60)
|
|
print(f"\nErgebnisse:")
|
|
print(f" • Executable: dist/DocuMentor/DocuMentor.exe")
|
|
print(f" • ZIP-Archiv: dist/{zip_name}.zip")
|
|
print("\nNächste Schritte:")
|
|
print(" 1. Testen Sie DocuMentor.exe auf einem Windows-System")
|
|
print(" 2. Optional: Erstellen Sie einen Installer mit Inno Setup")
|
|
|
|
return 0
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|