diff --git a/scripts/build_cosmo.sh b/scripts/build_cosmo.sh index 6800446f..4b1441d9 100755 --- a/scripts/build_cosmo.sh +++ b/scripts/build_cosmo.sh @@ -332,6 +332,16 @@ function build_python () { cd ${BUILDDIR} ${WORKDIR}/pyclean -v ${python_install_dir} + + cd ${python_install_dir} + + # bundle lib/ and licenses/ into a copy of python.com's own zip store + # so it runs standalone with no sibling files + # archives excluded - they can't be used to build native extensions anyways + cp ./bin/python.com ./bin/python.standalone.com + zip -qr9 ./bin/python.standalone.com lib licenses -x "lib/.aarch64/*" "lib/libpython*.a" + cd ${BUILDDIR} + mv ${python_install_dir} python-${python_distro_ver}-${PLATFORM}-${ARCH} tar -czf ${WORKDIR}/python-${python_distro_ver}-${PLATFORM}-${ARCH}.tar.gz python-${python_distro_ver}-${PLATFORM}-${ARCH} zip ${WORKDIR}/python-${python_distro_ver}-${PLATFORM}-${ARCH}.zip $(tar tf ${WORKDIR}/python-${python_distro_ver}-${PLATFORM}-${ARCH}.tar.gz) diff --git a/scripts/launch_test.sh b/scripts/launch_test.sh index fe3a2d72..79914406 100755 --- a/scripts/launch_test.sh +++ b/scripts/launch_test.sh @@ -177,6 +177,7 @@ function run_test () { unzip ${FULL_DISTRO}.zip cd ${FULL_DISTRO} chmod +x ./bin/python.com + chmod +x ./bin/python.standalone.com fi PYTHON_EXE=python.com ;; @@ -193,6 +194,29 @@ function run_test () { fi echo "::endgroup::" + + if [[ "${OS}" == "cosmo" ]]; then + echo "::group::Standalone Python ${python_distro_ver}" + + # move the single-file build out of the extracted distribution so it + # has no sibling files, proving it's actually standalone + STANDALONE_DIR=$(mktemp -d) + cp ${WORKDIR}/${FULL_DISTRO}/bin/python.standalone.com ${STANDALONE_DIR}/ + cd ${STANDALONE_DIR} + chmod +x ./python.standalone.com + + ./python.standalone.com --version + ./python.standalone.com -m sysconfig + ./python.standalone.com ${WORKDIR}/scripts/test.py + ./python.standalone.com -m pip + + if [[ "${RUN_TESTS}" == "true" ]]; then + ./python.standalone.com -m test -v -ulargefile,network,decimal,cpu,subprocess,urlfetch,tzdata --timeout 60 + fi + + cd ${WORKDIR} + echo "::endgroup::" + fi } run_test