fix(dist): stop stripping .py sources; wipe payload on NSIS upgrade
Two root causes for the 'imaging extension was built for another version of Pillow' error users hit after install: 1) cleanup_site_packages ran 'find ... -name "*.py" ! -name "__init__.py" -delete' with a comment claiming 'keep .pyc only' — but no compileall step exists. Result: the dist shipped __init__.py + .pyd only, missing every submodule (Image.py, ImageDraw.py, _version.py, ...). Fresh installs were broken; in-place upgrades produced a half-old/half-new site-packages. Removed the deletion entirely. 2) NSIS installer extracted over the previous install without cleaning python/, app/, scripts/. Upgrades left stale files (old PIL/_version.py next to new PIL/_imaging.pyd) which raised the Pillow ABI mismatch. Wipe those subtrees before File /r, preserving config.yaml at the install root.
This commit is contained in:
+9
-2
@@ -109,6 +109,13 @@ cleanup_site_packages() {
|
||||
# Strip debug symbols from native extensions
|
||||
find "$sp_dir" -name "*.$ext_suffix" -exec strip --strip-debug {} \; 2>/dev/null || true
|
||||
|
||||
# Remove .py source files (keep .pyc only) — saves ~30-40% on pure-Python packages
|
||||
find "$sp_dir" -name "*.py" ! -name "__init__.py" -delete 2>/dev/null || true
|
||||
# NOTE: do NOT strip .py source files. A previous version of this function
|
||||
# ran `find ... -name "*.py" ! -name "__init__.py" -delete` with a comment
|
||||
# claiming "keep .pyc only" — but no compileall step exists, so the dist
|
||||
# shipped with __init__.py + .pyd only, missing every submodule (Image.py,
|
||||
# ImageDraw.py, _version.py, ...). Fresh installs would fail with
|
||||
# ModuleNotFoundError; in-place upgrades over an older install produced a
|
||||
# half-old/half-new site-packages where PIL/__init__.py was new but
|
||||
# PIL/_version.py was stale, yielding the runtime "_imaging extension was
|
||||
# built for another version of Pillow" import error.
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user