From 37d268a907f477396dc61c9d720eae323871bcb9 Mon Sep 17 00:00:00 2001 From: icp Date: Wed, 1 Feb 2023 11:16:05 +0530 Subject: [PATCH] common/build-style/python3-pep517.sh: unpack wheels for testing Python packages built with pep517 system occasionally require accessing distinfo files and/or entry points provided by the package for tests to run. Since these assets are packed inside the wheel generated in `do_build`, the target wheel is unpacked in `do_check` first so that the said artifacts are accessible during test runs. --- common/build-style/python3-pep517.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/common/build-style/python3-pep517.sh b/common/build-style/python3-pep517.sh index b8bdee58520..f34b05c2a55 100644 --- a/common/build-style/python3-pep517.sh +++ b/common/build-style/python3-pep517.sh @@ -14,7 +14,18 @@ do_check() { if python3 -c 'import xdist' >/dev/null 2>&1; then testjobs="-n $XBPS_MAKEJOBS" fi - ${make_check_pre} python3 -m pytest ${testjobs} ${make_check_args} ${make_check_target} + + if [ -z "${make_install_target}" ]; then + local wheelbase="${pkgname#python3-}" + make_install_target="dist/${wheelbase//-/_}-${version}-*-*-*.whl" + fi + + local testdir="tmp/$(date +%s)" + python3 -m installer --destdir "${testdir}" \ + ${make_install_args} ${make_install_target} + + PATH="${testdir}/usr/bin:${PATH}" PYTHONPATH="${testdir}/${py3_sitelib}" \ + ${make_check_pre} pytest3 ${testjobs} ${make_check_args} ${make_check_target} else msg_warn "Unable to determine tests for PEP517 Python templates\n" return 0