Files
fcco-Converter/build.py
T

79 lines
2.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
"""
fcco-Converter V2 Build-Skript
Erstellt plattformabhängige Standalone-Executables mit PyInstaller.
Aufruf: python build.py
"""
import platform
import subprocess
import sys
from pathlib import Path
def build():
system = platform.system()
project_dir = Path(__file__).parent
# Basis-Argumente für PyInstaller
args = [
sys.executable,
"-m", "PyInstaller",
"--onefile",
"--windowed",
"--name", "fcco-Converter",
"--clean",
]
# Icon hinzufügen (wenn vorhanden)
icon_path = project_dir / "icon.ico"
if icon_path.exists():
if system == "Windows":
args.extend(["--icon", str(icon_path)])
elif system == "Darwin":
# macOS braucht .icns .ico funktioniert trotzdem als Fallback
args.extend(["--icon", str(icon_path)])
# Versteckte Imports (die PyInstaller evtl. nicht automatisch findet)
hidden_imports = [
"customtkinter",
"mutagen",
"mutagen.easyid3",
"mutagen.id3",
"static_ffmpeg",
]
for imp in hidden_imports:
args.extend(["--hidden-import", imp])
# CustomTkinter-Daten einbinden
try:
import customtkinter
ctk_path = Path(customtkinter.__file__).parent
if system == "Windows":
args.extend(["--add-data", f"{ctk_path};customtkinter"])
else:
args.extend(["--add-data", f"{ctk_path}:customtkinter"])
except ImportError:
print("WARNUNG: customtkinter nicht installiert. Bitte 'pip install -r requirements.txt' ausführen.")
# Hauptdatei
args.append(str(project_dir / "main.py"))
print(f"Build für {system}...")
print(f"Befehl: {' '.join(args)}")
print()
result = subprocess.run(args, cwd=str(project_dir))
if result.returncode == 0:
print()
print(f"Build erfolgreich! Ausgabe in: {project_dir / 'dist'}")
else:
print()
print(f"Build fehlgeschlagen (Code {result.returncode}).")
sys.exit(1)
if __name__ == "__main__":
build()