Files
aza/AzA march 2026 - Kopie (18)/build_empfang.ps1
2026-04-22 22:33:46 +02:00

59 lines
1.8 KiB
PowerShell

Write-Host "AZA Empfang Desktop-App Build gestartet..."
Write-Host ""
$projectRoot = $PSScriptRoot
Set-Location $projectRoot
Write-Host "Abhaengigkeiten installieren..."
pip install pywebview --quiet
pip install pyinstaller --quiet
Write-Host "Alte Artefakte bereinigen..."
$distExe = Join-Path $projectRoot "dist\AZA_Empfang.exe"
if (Test-Path $distExe) { Remove-Item $distExe -Force }
$iconFile = Join-Path $projectRoot "logo.ico"
$iconArg = @()
if (Test-Path $iconFile) {
$iconArg = @("--icon", $iconFile)
Write-Host " Icon: $iconFile"
} else {
Write-Host " Kein Icon gefunden (logo.ico) - baue ohne Icon"
}
Write-Host "EXE wird gebaut..."
Write-Host " Hinweis: backend_url.txt wird NICHT in die EXE gebunden — die Huelle nutzt"
Write-Host " standardmaessig https://empfang.aza-medwork.ch/empfang/ (unabhaengig von AzA Office)."
Write-Host " Optional: backend_url.txt NEBEN die fertige EXE legen, oder AZA_EMPFANG_URL setzen."
$appFile = Join-Path $projectRoot "aza_empfang_app.py"
$addData = @()
if ($env:AZA_EMBED_BACKEND_URL_IN_EMPFANG_EXE -eq "1") {
$urlFile = Join-Path $projectRoot "backend_url.txt"
if (Test-Path $urlFile) {
$addData = @("--add-data", "$urlFile;.")
Write-Host " AZA_EMBED_BACKEND_URL_IN_EMPFANG_EXE=1: bundle backend_url.txt (benoetigt AZA_EMPFANG_USE_BUNDLED_URL=1 zur Laufzeit)"
}
}
pyinstaller --noconfirm --onefile --windowed `
--name "AZA_Empfang" `
@iconArg `
@addData `
$appFile
if ($LASTEXITCODE -ne 0) {
Write-Error "Build fehlgeschlagen."
exit 1
}
$exePath = Join-Path $projectRoot "dist\AZA_Empfang.exe"
if (-not (Test-Path $exePath)) {
Write-Error "EXE nicht gefunden: $exePath"
exit 1
}
Write-Host ""
Write-Host "Build fertig."
Write-Host "Die App liegt in:"
Write-Host $exePath