diff --git a/build.py b/build.py index 3ce627e..d248be4 100644 --- a/build.py +++ b/build.py @@ -46,6 +46,8 @@ def ensure_project_root(): def run_build(): print(f"--- 1. Запуск PyInstaller для {APP_NAME} v{VERSION} ---") + icon_abs_path = os.path.abspath(ICON_PATH) + has_icon = os.path.exists(icon_abs_path) command = [ "pyinstaller", @@ -56,8 +58,8 @@ def run_build(): "--exclude-module", "PySide6.QtWebEngineWidgets", "--exclude-module", "PySide6.QtWebEngineQuick", f"--name={APP_NAME}", - f"--icon={ICON_PATH}" if os.path.exists(ICON_PATH) else "", - f"--add-data={ICON_PATH}{os.pathsep}." if os.path.exists(ICON_PATH) else "", + f"--icon={icon_abs_path}" if has_icon else "", + f"--add-data={icon_abs_path}{os.pathsep}." if has_icon else "", f"--add-data=auth_webview.py{os.pathsep}.", MAIN_SCRIPT ] @@ -74,16 +76,23 @@ def run_build(): def run_updater_build(): print(f"\n--- 1.2 Сборка {UPDATER_NAME} ---") + icon_abs_path = os.path.abspath(ICON_PATH) + has_icon = os.path.exists(icon_abs_path) + updater_spec_dir = os.path.join("build", "updater_spec") + updater_spec_path = os.path.join(updater_spec_dir, f"{UPDATER_NAME}.spec") + if os.path.exists(updater_spec_path): + os.remove(updater_spec_path) command = [ "pyinstaller", "--noconfirm", + "--clean", "--onefile", "--windowed", f"--name={UPDATER_NAME}", "--distpath", DIST_DIR, "--workpath", os.path.join("build", "updater"), - "--specpath", os.path.join("build", "updater_spec"), - f"--icon={ICON_PATH}" if os.path.exists(ICON_PATH) else "", + "--specpath", updater_spec_dir, + f"--icon={icon_abs_path}" if has_icon else "", UPDATER_SCRIPT, ] command = [arg for arg in command if arg]