Robust config search and ZIP packaging
This commit is contained in:
@@ -84,8 +84,29 @@ def build():
|
||||
if config_src.exists():
|
||||
shutil.copy(config_src, dist_dir / "config.json")
|
||||
|
||||
# ZIP-Archiv für das Release erstellen
|
||||
import tempfile
|
||||
zip_name = f"fcco-Converter-{system.lower()}"
|
||||
zip_path = dist_dir / zip_name
|
||||
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
tmp = Path(tmpdir)
|
||||
|
||||
# App/Exe ins Temp-Verzeichnis kopieren
|
||||
if system == "Darwin":
|
||||
shutil.copytree(dist_dir / f"{app_name}.app", tmp / f"{app_name}.app")
|
||||
else:
|
||||
shutil.copy(dist_dir / f"{app_name}.exe", tmp / f"{app_name}.exe")
|
||||
|
||||
# config.json mit in die ZIP packen
|
||||
if config_src.exists():
|
||||
shutil.copy(config_src, tmp / "config.json")
|
||||
|
||||
shutil.make_archive(str(zip_path), 'zip', str(tmp))
|
||||
|
||||
print()
|
||||
print(f"Build erfolgreich! Ausgabe in: {dist_dir}")
|
||||
print(f"ZIP für Release: {zip_path}.zip")
|
||||
else:
|
||||
print()
|
||||
print(f"Build fehlgeschlagen (Code {result.returncode}).")
|
||||
|
||||
@@ -23,11 +23,12 @@ def _load_app_info():
|
||||
try:
|
||||
# Finde config.json relativ zum Skript oder im PyInstaller Bundle
|
||||
if getattr(sys, "frozen", False):
|
||||
if platform.system() == "Darwin":
|
||||
# Path(sys.executable) ist fcco-Converter.app/Contents/MacOS/executable
|
||||
base_dir = Path(sys.executable).parent.parent.parent.parent
|
||||
else:
|
||||
base_dir = Path(sys.executable).parent
|
||||
# Suche ausgehend von der Executable aufwärts nach config.json
|
||||
base_dir = Path(sys.executable).parent
|
||||
while base_dir.name and str(base_dir) != base_dir.root:
|
||||
if (base_dir / "config.json").exists():
|
||||
break
|
||||
base_dir = base_dir.parent
|
||||
else:
|
||||
base_dir = Path(__file__).parent.parent
|
||||
|
||||
|
||||
Reference in New Issue
Block a user