diff --git a/build-common.sh b/build-common.sh index 5b8ef80..f35ca4c 100644 --- a/build-common.sh +++ b/build-common.sh @@ -217,10 +217,8 @@ smoke_test_imports() { # installation — Pillow for example is only a Windows dep. But if a # module's top-level package dir exists in site-packages and we # can't import it, that's a broken install and we abort. - PYTHONPATH="$pypath" "$py_cmd" - "$sp_dir" <<'PYEOF' || { - echo " ERROR: smoke test failed — site-packages is broken, aborting build" - return 1 - } + local smoke_script + smoke_script=$(cat <<'PYEOF' import importlib import os import sys @@ -266,4 +264,10 @@ if failed: print(f' Smoke test passed ({tested} imported, {skipped} not installed)') PYEOF +) + + if ! PYTHONPATH="$pypath" "$py_cmd" -c "$smoke_script" "$sp_dir"; then + echo " ERROR: smoke test failed — site-packages is broken, aborting build" + return 1 + fi }