Skip to content

Commit 73f3a5c

Browse files
committed
Prune extra lib dirs and pip packages
Update the Windows packaging step to exclude additional standard-lib directories (ensurepip, pydoc_data, lib2to3) and to remove bundled packaging packages from site-packages. Adds $pruneSitePackagesPatterns (pip*, setuptools*, wheel*) and a loop that deletes matching entries under Lib/site-packages to reduce archive size and remove unnecessary tooling from the distributed Python zip.
1 parent f7b2476 commit 73f3a5c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/workflows/build-python.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,11 @@ jobs:
122122
$zipPath = Join-Path $workspace "windows\python-windows-for-dart-$pyShort.zip"
123123
124124
# Cleanup/include lists kept in one place for visibility and maintenance.
125-
$pruneLibDirs = @("test", "idlelib", "tkinter", "turtledemo")
125+
$pruneLibDirs = @("test", "idlelib", "tkinter", "turtledemo", "ensurepip", "pydoc_data", "lib2to3")
126126
$pruneDllPatterns = @("_test*.pyd", "_ctypes_test*.pyd", "_tkinter*.pyd", "xxlimited*.pyd")
127127
$pruneDllFiles = @("tcl86t.dll", "tk86t.dll", "zlib1.dll", "pyshellext.dll", "pyshellext_d.dll")
128128
$keepImportLibs = @("python3.lib", "python3_d.lib", "python312.lib", "python312_d.lib")
129+
$pruneSitePackagesPatterns = @("pip*", "setuptools*", "wheel*")
129130
130131
New-Item -ItemType Directory -Force -Path $srcRoot | Out-Null
131132
@@ -192,6 +193,12 @@ jobs:
192193
Remove-Item -Recurse -Force $dirPath
193194
}
194195
}
196+
$sitePackagesDir = Join-Path "$packageRoot\Lib" "site-packages"
197+
if (Test-Path $sitePackagesDir) {
198+
foreach ($pattern in $pruneSitePackagesPatterns) {
199+
Get-ChildItem -Path $sitePackagesDir -Filter $pattern -Force -ErrorAction SilentlyContinue | Remove-Item -Recurse -Force
200+
}
201+
}
195202
196203
foreach ($pattern in $pruneDllPatterns) {
197204
Get-ChildItem -Path "$packageRoot\DLLs" -Filter $pattern -File -ErrorAction SilentlyContinue | Remove-Item -Force

0 commit comments

Comments
 (0)