Fix Python runtime cleanup on upgrade

This commit is contained in:
oliver 2026-10-12 17:11:48 +08:00
parent 5e80932c4a
commit 19d4597b94
5 changed files with 16 additions and 7 deletions

View file

@ -210,6 +210,8 @@ if ($CreateVenv) {
if (-not (Test-NetxVenvRunnable -VenvPython $venvPy)) {
throw "venv_not_runnable_after_build: check python/runtime copy"
}
& $venvPy -c "from pathlib import Path; import glob; print(Path.cwd()); print(glob.__file__)"
if ($LASTEXITCODE -ne 0) { throw "python_stdlib_smoke_failed: pathlib/glob import mismatch" }
& $venvPy -m pip install --upgrade pip
& $venvPy -m pip install -r (Join-Path $stage "requirements.txt")
@ -219,6 +221,8 @@ if ($CreateVenv) {
if (-not (Test-NetxVenvRunnable -VenvPython $venvPy)) {
throw "venv_not_runnable_after_pip"
}
& $venvPy -c "from pathlib import Path; import glob; print(Path.cwd()); print(glob.__file__)"
if ($LASTEXITCODE -ne 0) { throw "python_stdlib_smoke_failed_after_pip: pathlib/glob import mismatch" }
Write-Host "==> Slimming .venv (drop tests / __pycache__ / *.pyc)"
$site = Join-Path $stage ".venv\Lib\site-packages"