Skip to content

Commit

Permalink
fix and comment test c-extension handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mattip committed Aug 14, 2023
1 parent cf6683f commit 3e93741
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,18 @@ echo INCLUDEPY $(pypy -c "from distutils import sysconfig; print(sysconfig.get_c
ls $(pypy -c "from distutils import sysconfig; print(sysconfig.get_config_var('INCLUDEPY'))")

_PYTHON_SYSCONFIGDATA_NAME=$sysconfigdata_name pypy -c "from distutils import sysconfig; assert sysconfig.get_config_var('HOST_GNU_TYPE') != None"
# Build and copy the c-extension modules for the standard library
# Build the test c-extension modules then copy to the standard library
# PyPy uses a wrapper to trick the import system into gettig the c-extension from `/tmp`
# so that changing the code triggers a rebuild.
pypy -c "import _testcapi"
cp $(pypy -c "import _testcapi; print(_testcapi.__file__)") $PREFIX/lib/pypy${PY_VERSION}
if [[ "${PY_VERSION}" == "3.8" ]]; then
pypy -c "import _ctypes_test, _test_multiphase"
cp $(pypy -c "import _ctypes_test; print(_ctypes_test.__file__)") $PREFIX/lib/pypy${PY_VERSION}
cp $(pypy -c "import _testmultiphase; print(_testmultiphase.__file__)") $PREFIX/lib/pypy${PY_VERSION}
else
pypy -c "import _ctypes_test_build, _test_multiphase_build"
# Need to import the *build module to properly import the built module from `/tmp`
cp $(pypy -c "import _ctypes_test_build, _ctypes_test; print(_ctypes_test.__file__)") $PREFIX/lib/pypy${PY_VERSION}
cp $(pypy -c "import _testmultiphase_build, _testmultiphase; print(_testmultiphase.__file__)") $PREFIX/lib/pypy${PY_VERSION}
fi
Expand Down

0 comments on commit 3e93741

Please sign in to comment.