Files
aza/AzA march 2026 - Kopie (10)/check_dev_environment.ps1
2026-04-16 13:32:32 +02:00

160 lines
5.9 KiB
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# AZA Desktop Dev Environment Check
# Prueft ob alle Voraussetzungen fuer die Entwicklung vorhanden sind.
$ErrorActionPreference = "Continue"
$pass = 0
$fail = 0
function Check($name, $condition, $hint) {
if ($condition) {
Write-Host " [PASS] $name" -ForegroundColor Green
$script:pass++
} else {
Write-Host " [FAIL] $name" -ForegroundColor Red
if ($hint) { Write-Host " -> $hint" -ForegroundColor Yellow }
$script:fail++
}
}
Write-Host ""
Write-Host "=============================" -ForegroundColor Cyan
Write-Host " AZA Dev Environment Check" -ForegroundColor Cyan
Write-Host "=============================" -ForegroundColor Cyan
Write-Host ""
# --- Python ---
Write-Host "[Python]" -ForegroundColor White
$pyVer = $null
try {
$pyVer = & python --version 2>&1
$pyFound = $true
} catch { $pyFound = $false }
Check "Python installiert" $pyFound "Python 3.12.x installieren: https://python.org"
if ($pyFound -and $pyVer -match "3\.12\.") {
Check "Python 3.12.x" $true
} elseif ($pyFound) {
Check "Python 3.12.x (aktuell: $pyVer)" $false "Python 3.12.x empfohlen"
}
# --- venv ---
Write-Host ""
Write-Host "[Virtuelle Umgebung]" -ForegroundColor White
$venvExists = Test-Path ".\.venv\Scripts\python.exe"
Check ".venv vorhanden" $venvExists "python -m venv .venv"
# --- Wichtige Pakete ---
Write-Host ""
Write-Host "[Python-Pakete]" -ForegroundColor White
$packagesToCheck = @(
@{ Name = "fastapi"; Hint = "pip install fastapi" },
@{ Name = "uvicorn"; Hint = "pip install uvicorn" },
@{ Name = "openai"; Hint = "pip install openai" },
@{ Name = "numpy"; Hint = "pip install 'numpy==2.2.5'" },
@{ Name = "sounddevice"; Hint = "pip install sounddevice" },
@{ Name = "soundfile"; Hint = "pip install soundfile" },
@{ Name = "pygame"; Hint = "pip install pygame" },
@{ Name = "lameenc"; Hint = "pip install lameenc" },
@{ Name = "pynput"; Hint = "pip install pynput" },
@{ Name = "pillow"; Hint = "pip install pillow" },
@{ Name = "pyinstaller"; Hint = "pip install pyinstaller==6.13.0" },
@{ Name = "pydantic"; Hint = "pip install pydantic" },
@{ Name = "stripe"; Hint = "pip install stripe" },
@{ Name = "requests"; Hint = "pip install requests" },
@{ Name = "httpx"; Hint = "pip install httpx" },
@{ Name = "lxml"; Hint = "pip install lxml" },
@{ Name = "python-docx"; Hint = "pip install python-docx" },
@{ Name = "bcrypt"; Hint = "pip install bcrypt" },
@{ Name = "cryptography"; Hint = "pip install cryptography" },
@{ Name = "cffi"; Hint = "pip install cffi" },
@{ Name = "SQLAlchemy"; Hint = "pip install SQLAlchemy" }
)
foreach ($pkg in $packagesToCheck) {
$found = & python -c "import importlib; importlib.import_module('$($pkg.Name.Replace('-','_').ToLower())')" 2>&1
$ok = $LASTEXITCODE -eq 0
Check "$($pkg.Name)" $ok "$($pkg.Hint)"
}
# numpy Version pruefen
Write-Host ""
Write-Host "[numpy Version]" -ForegroundColor White
$npVer = & python -c "import numpy; print(numpy.__version__)" 2>&1
if ($LASTEXITCODE -eq 0) {
$npMajMin = $npVer -replace '(\d+\.\d+)\..*','$1'
$npOk = [double]$npMajMin -lt 2.4
Check "numpy < 2.4 (aktuell: $npVer)" $npOk "WICHTIG: pip install 'numpy==2.2.5' (2.4+ bricht PyInstaller)"
} else {
Check "numpy Version" $false "numpy nicht installiert"
}
# --- Audio Imports ---
Write-Host ""
Write-Host "[Audio-Imports]" -ForegroundColor White
$audioModules = @("sounddevice", "soundfile", "numpy", "lameenc", "pygame")
foreach ($mod in $audioModules) {
$ok = & python -c "import $mod" 2>&1
Check "import $mod" ($LASTEXITCODE -eq 0) "pip install $mod"
}
# --- ffmpeg ---
Write-Host ""
Write-Host "[Externe Tools]" -ForegroundColor White
$ffmpegPath = Get-Command "ffmpeg" -ErrorAction SilentlyContinue
Check "ffmpeg im PATH" ($null -ne $ffmpegPath) "winget install Gyan.FFmpeg"
# --- Inno Setup ---
$isccPaths = @(
"${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"
)
$isccFound = $false
foreach ($p in $isccPaths) {
if ($p -and (Test-Path $p)) { $isccFound = $true; break }
}
$isccCmd = Get-Command "ISCC.exe" -ErrorAction SilentlyContinue
if ($isccCmd) { $isccFound = $true }
Check "Inno Setup 6 (fuer Installer)" $isccFound "https://jrsoftware.org/isdl.php (optional, nur fuer Installer-Build)"
# --- Projektdateien ---
Write-Host ""
Write-Host "[Projektdateien]" -ForegroundColor White
$requiredFiles = @(
"basis14.py",
"backend_main.py",
"aza_desktop.spec",
"requirements-dev.txt",
"logo.ico",
"logo.png",
"aza_version.py"
)
foreach ($f in $requiredFiles) {
Check $f (Test-Path $f) "Datei fehlt: $f"
}
# --- Konfiguration ---
Write-Host ""
Write-Host "[Konfiguration]" -ForegroundColor White
Check ".env vorhanden" (Test-Path ".env") "Copy-Item .env.example .env -> dann Werte eintragen"
Check "backend_url.txt" (Test-Path "backend_url.txt") "Datei erstellen mit: http://127.0.0.1:8000"
Check "backend_token.txt" (Test-Path "backend_token.txt") "Token passend zu MEDWORK_API_TOKEN in .env eintragen"
Check "config\aza_runtime.env" (Test-Path "config\aza_runtime.env") "OpenAI API Key eintragen"
# --- Ergebnis ---
Write-Host ""
Write-Host "=============================" -ForegroundColor Cyan
$total = $pass + $fail
Write-Host " Ergebnis: $pass/$total PASS, $fail FAIL" -ForegroundColor $(if ($fail -eq 0) { "Green" } else { "Yellow" })
Write-Host "=============================" -ForegroundColor Cyan
Write-Host ""
if ($fail -eq 0) {
Write-Host "Alles bereit fuer die Entwicklung!" -ForegroundColor Green
} else {
Write-Host "Bitte die FAIL-Punkte oben beheben." -ForegroundColor Yellow
Write-Host "Danach erneut ausfuehren: .\check_dev_environment.ps1" -ForegroundColor Yellow
}
Write-Host ""