Run Python smoke code in AppContainer
This commit is contained in:
@@ -11,6 +11,7 @@ $outputDir = Join-Path $env:TEMP ("SovereignAI-AppContainer-" + [guid]::NewGuid(
|
||||
New-Item -ItemType Directory -Path $outputDir | Out-Null
|
||||
$exe = Join-Path $outputDir 'appcontainer_probe.exe'
|
||||
$obj = Join-Path $outputDir 'appcontainer_probe.obj'
|
||||
$previousPythonHome = $env:SOVEREIGNAI_PYTHON_HOME
|
||||
|
||||
try {
|
||||
Push-Location $repoRoot
|
||||
@@ -21,6 +22,11 @@ try {
|
||||
throw "C++ probe compilation failed with exit code $LASTEXITCODE"
|
||||
}
|
||||
|
||||
$pythonHome = (& python -c 'import sys; print(sys.base_prefix)').Trim()
|
||||
if ($LASTEXITCODE -ne 0 -or -not (Test-Path -LiteralPath $pythonHome -PathType Container)) {
|
||||
throw 'Could not locate the active Python runtime to test isolated Python execution.'
|
||||
}
|
||||
$env:SOVEREIGNAI_PYTHON_HOME = $pythonHome
|
||||
& $exe
|
||||
$probeExit = $LASTEXITCODE
|
||||
if ($probeExit -ne 0) {
|
||||
@@ -30,6 +36,11 @@ try {
|
||||
Pop-Location
|
||||
}
|
||||
} finally {
|
||||
if ($null -eq $previousPythonHome) {
|
||||
Remove-Item Env:SOVEREIGNAI_PYTHON_HOME -ErrorAction SilentlyContinue
|
||||
} else {
|
||||
$env:SOVEREIGNAI_PYTHON_HOME = $previousPythonHome
|
||||
}
|
||||
$resolvedOutput = (Resolve-Path -LiteralPath $outputDir -ErrorAction SilentlyContinue).Path
|
||||
$tempRoot = [IO.Path]::GetFullPath($env:TEMP).TrimEnd('\') + '\'
|
||||
if ($resolvedOutput -and $resolvedOutput.StartsWith($tempRoot, [StringComparison]::OrdinalIgnoreCase) -and
|
||||
|
||||
Reference in New Issue
Block a user