From bf7e5e599e9be915ae2f9c7e790edfa641e4bc08 Mon Sep 17 00:00:00 2001 From: benya Date: Sun, 15 Feb 2026 22:11:24 +0300 Subject: [PATCH] fix(installer): improve ISCC diagnostics and icon handling - make SetupIconFile optional in Inno script - print full ISCC stdout/stderr on build failure - copy icon.ico into dist artifacts explicitly --- build.py | 34 ++++++++++++++++++++++++++++++++-- installer/AnabasisManager.iss | 2 ++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/build.py b/build.py index ca71a45..6d9ebde 100644 --- a/build.py +++ b/build.py @@ -38,6 +38,22 @@ def write_version_marker(): sys.exit(1) +def copy_icon_to_dist(): + icon_abs_path = os.path.abspath(ICON_PATH) + if not os.path.exists(icon_abs_path): + print("[WARN] icon.ico не найден, пропуск копирования иконки в dist.") + return + try: + os.makedirs("dist", exist_ok=True) + os.makedirs(DIST_DIR, exist_ok=True) + shutil.copy2(icon_abs_path, os.path.join("dist", "icon.ico")) + shutil.copy2(icon_abs_path, os.path.join(DIST_DIR, "icon.ico")) + print("[OK] Иконка скопирована в dist/icon.ico и dist/AnabasisManager/icon.ico") + except Exception as e: + print(f"[ERROR] Не удалось скопировать icon.ico в dist: {e}") + sys.exit(1) + + def ensure_project_root(): missing = [name for name in SAFE_CLEAN_ROOT_FILES if not os.path.exists(name)] if missing: @@ -181,13 +197,26 @@ def build_installer(): os.path.abspath(INSTALLER_SCRIPT), ] try: - subprocess.check_call(command) + completed = subprocess.run( + command, + capture_output=True, + text=True, + encoding="utf-8", + errors="replace", + check=False, + ) + if completed.stdout: + print(completed.stdout.rstrip()) + if completed.stderr: + print(completed.stderr.rstrip()) + if completed.returncode != 0: + raise RuntimeError(f"ISCC exited with code {completed.returncode}") installer_path = os.path.join("dist", INSTALLER_NAME) if not os.path.exists(installer_path): print(f"[ERROR] Установщик не создан: {installer_path}") sys.exit(1) print(f"[OK] Установщик создан: {installer_path}") - except subprocess.CalledProcessError as e: + except Exception as e: print(f"[ERROR] Ошибка при создании установщика: {e}") sys.exit(1) @@ -202,6 +231,7 @@ if __name__ == "__main__": run_build() run_updater_build() run_cleanup() + copy_icon_to_dist() write_version_marker() create_archive() build_installer() diff --git a/installer/AnabasisManager.iss b/installer/AnabasisManager.iss index f86fbc4..91aee26 100644 --- a/installer/AnabasisManager.iss +++ b/installer/AnabasisManager.iss @@ -28,7 +28,9 @@ SolidCompression=yes WizardStyle=modern ArchitecturesInstallIn64BitMode=x64compatible UninstallDisplayIcon={app}\AnabasisManager.exe +#ifexist MyIconFile SetupIconFile={#MyIconFile} +#endif [Languages] Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"