Files
aza/AzA march 2026/build_empfang_installer.ps1
2026-05-11 08:27:44 +02:00

126 lines
3.8 KiB
PowerShell

# Build: AZA_EmpfangShell.exe (PyInstaller) + Inno Setup Installer nur fuer Praxis-Chat-Huelle.
# Ausgabe: dist\installer\aza_empfang_chat_setup.exe
# Unabhaengig von build_exe.ps1 / aza_desktop_setup.exe
$ErrorActionPreference = "Stop"
$projectRoot = $PSScriptRoot
Set-Location $projectRoot
$specRel = "AZA_EmpfangShell.spec"
$specFile = Join-Path $projectRoot $specRel
$innoScript = Join-Path $projectRoot "installer\aza_empfang_shell_installer.iss"
$setupOutput = Join-Path $projectRoot "dist\installer\aza_empfang_chat_setup.exe"
$shellExe = Join-Path $projectRoot "dist\AZA_EmpfangShell.exe"
$azaVersionPy = Join-Path $projectRoot "aza_version.py"
$logoIco = Join-Path $projectRoot "logo.ico"
function Find-InnoSetup {
$candidates = @(
"${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe",
"${env:ProgramFiles}\Inno Setup 6\ISCC.exe",
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe",
"C:\Program Files\Inno Setup 6\ISCC.exe",
"${env:LOCALAPPDATA}\Programs\Inno Setup 6\ISCC.exe"
)
foreach ($path in $candidates) {
if ($path -and (Test-Path $path)) { return $path }
}
$isccInPath = Get-Command "ISCC.exe" -ErrorAction SilentlyContinue
if ($isccInPath) { return $isccInPath.Source }
return $null
}
Write-Host "=== AzA Empfang Chat - Shell-EXE + Installer ===" -ForegroundColor Cyan
Write-Host ""
if (-not (Test-Path $specFile)) {
Write-Error "SPEC nicht gefunden: $specFile"
exit 1
}
if (-not (Test-Path (Join-Path $projectRoot "aza_empfang_webview.py"))) {
Write-Error "aza_empfang_webview.py fehlt."
exit 1
}
if (-not (Test-Path $innoScript)) {
Write-Error "Inno-Script fehlt: $innoScript"
exit 1
}
if (-not (Test-Path $logoIco)) {
Write-Error "logo.ico fehlt: $logoIco"
exit 1
}
Write-Host "[1/3] pip: pywebview, pyinstaller..."
python -m pip install --disable-pip-version-check -q pywebview pyinstaller
if ($LASTEXITCODE -ne 0) {
Write-Error "pip install fehlgeschlagen."
exit 1
}
Write-Host "[2/3] Build-Stamp (_build_info.py)..."
$stampScript = Join-Path $projectRoot "aza_build_stamp.py"
if (Test-Path $stampScript) {
python $stampScript
if ($LASTEXITCODE -ne 0) {
Write-Warning "Build-Stamp fehlgeschlagen - fortfahren."
}
}
Write-Host "[2/3] PyInstaller: $specRel ..."
pyinstaller --noconfirm $specFile
if ($LASTEXITCODE -ne 0) {
Write-Error "PyInstaller fehlgeschlagen."
exit 1
}
if (-not (Test-Path $shellExe)) {
Write-Error "EXE nicht gefunden: $shellExe"
exit 1
}
Write-Host " OK: $shellExe"
# Version fuer Inno
$appVersion = "0.0.0"
if (Test-Path $azaVersionPy) {
$versionContent = Get-Content $azaVersionPy -Raw
if ($versionContent -match 'APP_VERSION\s*=\s*"([^"]+)"') {
$appVersion = $matches[1].Trim()
}
}
$innoCompiler = Find-InnoSetup
if (-not $innoCompiler) {
Write-Error "Inno Setup 6 (ISCC.exe) nicht gefunden. Bitte installieren: https://jrsoftware.org/isdl.php"
exit 1
}
Write-Host " ISCC: $innoCompiler"
$outDir = Split-Path $setupOutput -Parent
if (-not (Test-Path $outDir)) {
New-Item -ItemType Directory -Path $outDir | Out-Null
}
Write-Host "[3/3] Inno Setup (Version $appVersion)..."
& $innoCompiler "/DMyAppVersion=$appVersion" $innoScript
if ($LASTEXITCODE -ne 0) {
Write-Error "Inno Build fehlgeschlagen."
exit 1
}
if (-not (Test-Path $setupOutput)) {
Write-Error "Setup nicht gefunden: $setupOutput"
exit 1
}
$item = Get-Item -LiteralPath $setupOutput
$hash = (Get-FileHash -LiteralPath $setupOutput -Algorithm SHA256).Hash
Write-Host ""
Write-Host "=== Fertig ===" -ForegroundColor Green
Write-Host "Installationsdatei:"
Write-Host " Pfad: $($item.FullName)"
Write-Host " LastWriteTime: $($item.LastWriteTime)"
Write-Host " Groesse (Bytes): $($item.Length)"
Write-Host " SHA256: $hash"
Write-Host ""
Write-Host "USB-Stick: Datei kopieren:"
Write-Host " $($item.FullName)"