feat(installer): add Inno Setup packaging to release

- add installer/AnabasisManager.iss for per-user install without admin rights

- extend build.py to produce setup.exe via ISCC

- publish setup.exe and checksums in release workflow
This commit is contained in:
2026-02-15 22:01:47 +03:00
parent 1b4760167f
commit 965d09d47c
3 changed files with 138 additions and 6 deletions

View File

@@ -11,8 +11,10 @@ VERSION = APP_VERSION # Единая версия приложения
MAIN_SCRIPT = "main.py"
UPDATER_SCRIPT = "updater_gui.py"
ICON_PATH = "icon.ico"
INSTALLER_SCRIPT = os.path.join("installer", "AnabasisManager.iss")
DIST_DIR = os.path.join("dist", APP_NAME)
ARCHIVE_NAME = f"{APP_NAME}-{VERSION}" # Формат Название-Версия
INSTALLER_NAME = f"{APP_NAME}-setup-{VERSION}.exe"
SAFE_CLEAN_ROOT_FILES = {"main.py", "updater_gui.py", "requirements.txt", "build.py"}
REMOVE_LIST = [
"Qt6Pdf.dll", "Qt6PdfQuick.dll", "Qt6PdfWidgets.dll",
@@ -137,6 +139,59 @@ def create_archive():
print(f"[ERROR] Не удалось создать архив: {e}")
def _find_iscc():
candidates = []
iscc_env = os.getenv("ISCC_PATH", "").strip()
if iscc_env:
candidates.append(iscc_env)
candidates.append(shutil.which("iscc"))
candidates.append(shutil.which("ISCC.exe"))
candidates.append(r"C:\Program Files (x86)\Inno Setup 6\ISCC.exe")
candidates.append(r"C:\Program Files\Inno Setup 6\ISCC.exe")
for candidate in candidates:
if candidate and os.path.exists(candidate):
return candidate
return ""
def build_installer():
print(f"\n--- 4. Создание установщика {INSTALLER_NAME} ---")
if os.name != "nt":
print("[INFO] Установщик Inno Setup создается только на Windows. Шаг пропущен.")
return
if not os.path.exists(INSTALLER_SCRIPT):
print(f"[ERROR] Не найден скрипт установщика: {INSTALLER_SCRIPT}")
sys.exit(1)
if not os.path.exists(DIST_DIR):
print(f"[ERROR] Не найдена папка сборки приложения: {DIST_DIR}")
sys.exit(1)
iscc_path = _find_iscc()
if not iscc_path:
print("[ERROR] Не найден Inno Setup Compiler (ISCC.exe).")
print("[ERROR] Установите Inno Setup 6 или задайте переменную окружения ISCC_PATH.")
sys.exit(1)
icon_abs_path = os.path.abspath(ICON_PATH)
command = [
iscc_path,
f"/DMyAppVersion={VERSION}",
f"/DMySourceDir={os.path.abspath(DIST_DIR)}",
f"/DMyOutputDir={os.path.abspath('dist')}",
f"/DMyIconFile={icon_abs_path}",
os.path.abspath(INSTALLER_SCRIPT),
]
try:
subprocess.check_call(command)
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:
print(f"[ERROR] Ошибка при создании установщика: {e}")
sys.exit(1)
if __name__ == "__main__":
ensure_project_root()
# Предварительная очистка
@@ -149,8 +204,10 @@ if __name__ == "__main__":
run_cleanup()
write_version_marker()
create_archive()
build_installer()
print("\n" + "=" * 30)
print("ПРОЦЕСС ЗАВЕРШЕН")
print(f"Файл для отправки: dist/{ARCHIVE_NAME}.zip")
print(f"Установщик: dist/{INSTALLER_NAME}")
print("=" * 30)