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
This commit is contained in:
34
build.py
34
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()
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user