fix(install): guard Windows desktop installs against broken web_server

This commit is contained in:
konsisumer 2026-07-06 00:58:24 +02:00 committed by Teknium
parent 94205a1139
commit 18e840469f
4 changed files with 73 additions and 4 deletions

View file

@ -1995,6 +1995,7 @@ print(','.join(scripts))
$pythonExe = if (-not $NoVenv) { "$InstallDir\venv\Scripts\python.exe" } else { (& $UvCmd python find $PythonVersion) }
if (Test-Path $pythonExe) {
$webOk = $false
$webServerSyntaxOk = $false
# Relax EAP=Stop while running the import probe; see the matching
# comment on the baseline-imports check above. Python writes
# deprecation warnings to stderr and we don't want those wrapped
@ -2006,6 +2007,10 @@ print(','.join(scripts))
& $pythonExe -c "import fastapi, uvicorn" 2>&1 | Out-Null
if ($LASTEXITCODE -eq 0) { $webOk = $true }
} catch { }
try {
& $pythonExe -m py_compile "$InstallDir\hermes_cli\web_server.py" 2>&1 | Out-Null
if ($LASTEXITCODE -eq 0) { $webServerSyntaxOk = $true }
} catch { }
$ErrorActionPreference = $prevEAP
if (-not $webOk) {
Write-Warn "fastapi/uvicorn not importable -- `hermes dashboard` will not work."
@ -2017,6 +2022,9 @@ print(','.join(scripts))
Write-Warn "Could not install [web] extra. Run manually: uv pip install --python `"$pythonExe`" `"fastapi>=0.104,<1`" `"uvicorn[standard]>=0.24,<1`""
}
}
if (-not $webServerSyntaxOk) {
throw "dashboard backend source failed syntax check: hermes_cli/web_server.py"
}
}
Pop-Location