Drop docs, stdlib tests and Tk/IDLE from the bundled Python runtime.

NetX runs headless; these were ~70MB of the runtime (107MB -> 34MB) and made
CI Setups ~30MB larger than local ones. Setup: 105MB (CI) / 75MB -> 67MB.
ensurepip stays for venv creation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
oliver 2026-10-13 21:46:51 +08:00
parent a82e546918
commit 7a4e2b9477

View file

@ -216,7 +216,12 @@ if ($CreateVenv) {
$spEx = Join-Path $prefix "Lib\site-packages" $spEx = Join-Path $prefix "Lib\site-packages"
$robocopy = Join-Path $env:SystemRoot "System32\robocopy.exe" $robocopy = Join-Path $env:SystemRoot "System32\robocopy.exe"
if (-not (Test-Path -LiteralPath $robocopy)) { throw "robocopy_not_found" } if (-not (Test-Path -LiteralPath $robocopy)) { throw "robocopy_not_found" }
& $robocopy $prefix $rtDir /E /XD $spEx __pycache__ /XF *.pyc /NFL /NDL /NJH /NJS /nc /ns /np | Out-Null # Headless server: drop docs, the stdlib test suite and Tk/IDLE (~100MB unpacked).
# Keep ensurepip - venv creation needs it. Same result on CI and local builds.
$xdRuntime = @("Doc", "tcl", "Tools", "Lib\test", "Lib\idlelib", "Lib\tkinter", "Lib\turtledemo") |
ForEach-Object { Join-Path $prefix $_ }
$xfRuntime = @("_tkinter.pyd", "tcl86t.dll", "tk86t.dll", "*.pyc")
& $robocopy $prefix $rtDir /E /XD $spEx __pycache__ @xdRuntime /XF @xfRuntime /NFL /NDL /NJH /NJS /nc /ns /np | Out-Null
if ($LASTEXITCODE -ge 8) { throw "robocopy_python_runtime_failed: exit $LASTEXITCODE" } if ($LASTEXITCODE -ge 8) { throw "robocopy_python_runtime_failed: exit $LASTEXITCODE" }
$rtPy = Join-Path $rtDir "python.exe" $rtPy = Join-Path $rtDir "python.exe"