fix(build): stop stripping zeroconf/_services + add import smoke test
Lint & Test / test (push) Successful in 2m39s
Lint & Test / test (push) Successful in 2m39s
- build-common.sh: remove zeroconf/_services from the strip list. zeroconf's compiled Cython _listener.pyd imports from _services internally, so stripping it broke `import zeroconf` at runtime with ModuleNotFoundError — same class of bug as the numpy.linalg strip. - build-common.sh: add smoke_test_imports() that imports every top-level dependency against the stripped site-packages. Catches "we stripped something that was actually needed" regressions at build time instead of on a user's machine after install. - build-dist.sh: wire smoke test into the Linux flow (runs real imports). - build-dist-windows.sh: cross-build can't load win_amd64 .pyd files with the host python, so instead verify that the known-required submodule dirs (numpy.linalg/lib/matrixlib/ma, zeroconf._services) exist after cleanup. Fails loud if any future strip-rule removes them.
This commit is contained in:
@@ -279,6 +279,21 @@ find "$SITE_PACKAGES/winrt" -name "*.pyi" -delete 2>/dev/null || true
|
||||
# the generated .pyc will ImportError on the target.
|
||||
compile_and_strip_sources "$SITE_PACKAGES" "python"
|
||||
|
||||
# Windows cross-build: host python can't load win_amd64 .pyd files, so
|
||||
# we can't `import numpy` for real. Instead, check that the submodules
|
||||
# known to be imported internally exist on disk — the same landmines that
|
||||
# cost users a broken v0.0.0.dev0 installer.
|
||||
echo " Verifying required submodules exist after cleanup..."
|
||||
for required in \
|
||||
"numpy/linalg" "numpy/lib" "numpy/matrixlib" "numpy/ma" \
|
||||
"zeroconf/_services"; do
|
||||
if [ ! -d "$SITE_PACKAGES/$required" ] && [ ! -f "$SITE_PACKAGES/$required.py" ] && [ ! -f "$SITE_PACKAGES/$required.pyc" ]; then
|
||||
echo " ERROR: $required missing from site-packages — cleanup_site_packages removed something required. Aborting."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo " All required submodules present."
|
||||
|
||||
WHEEL_COUNT=$(ls "$WHEEL_DIR"/*.whl 2>/dev/null | wc -l)
|
||||
echo " Installed $WHEEL_COUNT packages"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user