From b9cc6b6690c3a6daed8a5c4472cb16c58c856c06 Mon Sep 17 00:00:00 2001 From: icp Date: Wed, 1 Feb 2023 11:16:05 +0530 Subject: [PATCH 1/9] 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 b8bdee585208..f34b05c2a550 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 From 9041067c1a0eb5e721c6920b7604af5b983bb0d9 Mon Sep 17 00:00:00 2001 From: icp Date: Wed, 1 Feb 2023 11:48:00 +0530 Subject: [PATCH 2/9] fava: repackage with updated pep517 build style --- srcpkgs/fava/template | 1 - 1 file changed, 1 deletion(-) diff --git a/srcpkgs/fava/template b/srcpkgs/fava/template index 5bf30cb3f3c3..8e7d7c914bb9 100644 --- a/srcpkgs/fava/template +++ b/srcpkgs/fava/template @@ -3,7 +3,6 @@ pkgname=fava version=1.23.1 revision=1 build_style=python3-pep517 -make_check_args="--deselect tests/test_cli.py::test_cli" hostmakedepends="python3-setuptools_scm python3-wheel" depends="python3-Babel python3-Cheroot python3-Flask-Babel python3-Flask python3-Jinja2 beancount python3-click python3-markdown2 python3-ply From 4f9969f8f15eb9bb3a0def53a86210e29fafa18e Mon Sep 17 00:00:00 2001 From: icp Date: Wed, 1 Feb 2023 18:30:34 +0530 Subject: [PATCH 3/9] hatch: repackage with updated pep517 build style --- srcpkgs/hatch/template | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/srcpkgs/hatch/template b/srcpkgs/hatch/template index 670f9b987fa6..1c047cec3821 100644 --- a/srcpkgs/hatch/template +++ b/srcpkgs/hatch/template @@ -5,10 +5,8 @@ revision=2 build_style=python3-pep517 # ignore backend tests, because updating hatchling when there is no new hatch # version yet breaks these in hatch. -make_check_args="--deselect tests/cli/test_root.py::TestFreshInstallation::test_config_file_creation_verbose - --deselect tests/cli/run/test_run.py::test_scripts_no_environment - --ignore tests/backend - --ignore backend/tests" +make_check_args="--ignore tests/backend + --deselect tests/cli/run/test_run.py::test_scripts_no_environment" _deps="python3-click hatchling python3-httpx python3-hyperlink python3-keyring python3-packaging python3-pexpect python3-platformdirs python3-pyperclip python3-rich python3-shellingham python3-tomli-w python3-tomlkit From df43b017ac23894faa4e564c00af9637225a572f Mon Sep 17 00:00:00 2001 From: icp Date: Wed, 1 Feb 2023 18:22:59 +0530 Subject: [PATCH 4/9] python3-quart: repackage with updated pep517 build style --- srcpkgs/python3-quart/template | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/srcpkgs/python3-quart/template b/srcpkgs/python3-quart/template index 71aefd7c7ebc..63c3e4975e1b 100644 --- a/srcpkgs/python3-quart/template +++ b/srcpkgs/python3-quart/template @@ -7,7 +7,7 @@ make_install_target="dist/quart-${version}-*-*-*.whl" hostmakedepends="python3-poetry-core" depends="python3-aiofiles python3-hypercorn python3-click python3-MarkupSafe python3-blinker python3-itsdangerous python3-Jinja2 python3-Werkzeug" -checkdepends="python3-pytest-asyncio python3-hypothesis python3-mock python3-dotenv unzip $depends" +checkdepends="python3-pytest-asyncio python3-hypothesis python3-mock python3-dotenv $depends" short_desc="Python asyncio ASGI web framework with Flask API" maintainer="Andrew J. Hesford " license="MIT" @@ -16,14 +16,8 @@ changelog="https://raw.githubusercontent.com/pallets/quart/main/CHANGES.rst" distfiles="https://github.com/pallets/quart/archive/refs/tags/${version}.tar.gz" checksum=68ce4e6f786d5bf4a6056569e07e7055e1dfbb7136a531a18087345d8ba34c5c -do_check() { - # Tests require dist-info on the package, which is only in the wheel. - # Pip can install the wheel in the build tree, but unzip is less evil. - mkdir -p test - unzip ${make_install_target} -d test - +pre_check() { vsed -e '/addopts/d' -i pyproject.toml - PYTHONPATH=test python3 -m pytest } post_install() { From 2eea73bb5b0aa20b7e5c576c177fcab4e3dd9b7f Mon Sep 17 00:00:00 2001 From: icp Date: Wed, 1 Feb 2023 18:45:21 +0530 Subject: [PATCH 5/9] python3-bcrypt: repackage with updated pep517 build style --- srcpkgs/python3-bcrypt/template | 4 ---- 1 file changed, 4 deletions(-) diff --git a/srcpkgs/python3-bcrypt/template b/srcpkgs/python3-bcrypt/template index ae3006dd6695..869fe684ce2f 100644 --- a/srcpkgs/python3-bcrypt/template +++ b/srcpkgs/python3-bcrypt/template @@ -14,7 +14,3 @@ homepage="https://github.com/pyca/bcrypt" changelog="https://github.com/pyca/bcrypt/blob/main/README.rst#changelog" distfiles="${PYPI_SITE}/b/bcrypt/bcrypt-${version}.tar.gz" checksum=433c410c2177057705da2a9f2cd01dd157493b2a7ac14c8593a16b3dab6b6bfb - -do_check() { - PYTHONPATH="$(cd build/lib* && pwd)" pytest -} From ac7c0d9d4dd996c6457bc778ae76f3ebdba34778 Mon Sep 17 00:00:00 2001 From: icp Date: Wed, 1 Feb 2023 19:32:19 +0530 Subject: [PATCH 6/9] python3-adblock: repackage with updated pep517 build style --- srcpkgs/python3-adblock/template | 5 ----- 1 file changed, 5 deletions(-) diff --git a/srcpkgs/python3-adblock/template b/srcpkgs/python3-adblock/template index ebd4a7f62acc..6c44e84c6f13 100644 --- a/srcpkgs/python3-adblock/template +++ b/srcpkgs/python3-adblock/template @@ -33,11 +33,6 @@ do_build() { mv adblock-${version}-*.whl dist/adblock-${version}-py3-none-any.whl } -pre_check() { - # Tests require the compiled extension - cp target/${RUST_TARGET}/release/libadblock.so adblock/adblock.so -} - post_install() { vlicense LICENSE-MIT chmod 755 ${DESTDIR}/${py3_sitelib}/adblock/*.so From a93746a7ef9075b7e72e459425955c123a16cd68 Mon Sep 17 00:00:00 2001 From: icp Date: Wed, 1 Feb 2023 18:33:39 +0530 Subject: [PATCH 7/9] python3-jsonschema: repackage with updated pep517 build style --- srcpkgs/python3-jsonschema/template | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/srcpkgs/python3-jsonschema/template b/srcpkgs/python3-jsonschema/template index f9b0c2e19528..8ec7cef8d755 100644 --- a/srcpkgs/python3-jsonschema/template +++ b/srcpkgs/python3-jsonschema/template @@ -3,6 +3,7 @@ pkgname=python3-jsonschema version=4.17.3 revision=1 build_style=python3-pep517 +make_check_args="--deselect jsonschema/tests/test_jsonschema_test_suite.py::test_suite_bug" hostmakedepends="hatchling hatch-vcs" depends="python3-attrs python3-pyrsistent" checkdepends="${depends} python3-pytest python3-pip" @@ -14,16 +15,6 @@ changelog="https://raw.githubusercontent.com/Julian/jsonschema/master/CHANGELOG. distfiles="${PYPI_SITE}/j/jsonschema/jsonschema-${version}.tar.gz" checksum=0f864437ab8b6076ba6707453ef8f98a6a0d512a80e93f8abdb676f737ecb60d -do_check() { - rm -rf *.dist-info tmp # remove artifacts from previous unsuccessful check run - mkdir tmp - bsdtar xf dist/jsonschema-$version-py3-none-any.whl -C tmp - rm tmp/jsonschema/tests -rf - mv tmp/*.dist-info . - PYTHONPATH=. pytest --deselect jsonschema/tests/test_jsonschema_test_suite.py::test_suite_bug - rm -rf *.dist-info tmp -} - pre_build() { export SETUPTOOLS_SCM_PRETEND_VERSION="${version}" } From 8904bbe2673f7b6d4d0ba0392ef575aa41622077 Mon Sep 17 00:00:00 2001 From: icp Date: Wed, 1 Feb 2023 18:52:21 +0530 Subject: [PATCH 8/9] python3-pytest-isort: repackage with updated pep517 build style --- srcpkgs/python3-pytest-isort/template | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/srcpkgs/python3-pytest-isort/template b/srcpkgs/python3-pytest-isort/template index c3566853a180..bf3b5dcab8b5 100644 --- a/srcpkgs/python3-pytest-isort/template +++ b/srcpkgs/python3-pytest-isort/template @@ -11,10 +11,8 @@ maintainer="Jan Christian Grünhage " license="MIT" homepage="https://github.com/stephrdev/pytest-isort" changelog="https://github.com/stephrdev/pytest-isort/raw/master/CHANGELOG.rst" -distfiles="${PYPI_SITE}/p/pytest_isort/pytest_isort-${version}.tar.gz" -checksum=067801dc5e54a474330d074d521c815948ff6d5cf0ed3b9d057b78216851186c -# cba for now -make_check=no +distfiles="https://github.com/stephrdev/pytest-isort/archive/refs/tags/${version}.tar.gz" +checksum=c6994dd442e2fe50f2667d6fa6e14a5800192966b628cc31107c8f96c36a514b post_install() { vlicense LICENSE.rst From e836cba32e6c6ae1610a74bb6066fee1339be719 Mon Sep 17 00:00:00 2001 From: icp Date: Wed, 1 Feb 2023 18:35:10 +0530 Subject: [PATCH 9/9] python3-pytest-httpserver: repackage with updated pep517 build style --- srcpkgs/python3-pytest-httpserver/template | 8 -------- 1 file changed, 8 deletions(-) diff --git a/srcpkgs/python3-pytest-httpserver/template b/srcpkgs/python3-pytest-httpserver/template index 5fa0f6f24ea5..f04aa3c6b4b5 100644 --- a/srcpkgs/python3-pytest-httpserver/template +++ b/srcpkgs/python3-pytest-httpserver/template @@ -14,14 +14,6 @@ changelog="https://raw.githubusercontent.com/csernazs/pytest-httpserver/master/C distfiles="https://github.com/csernazs/pytest-httpserver/archive/refs/tags/${version}.tar.gz" checksum=932843df9fa584e6a664b2e7a21dec4ddf9507c235a78853f21e00b111352395 -do_check() { - rm -rf tmp # remove artifacts from previous unsuccessful check run - mkdir tmp - bsdtar xf dist/pytest_httpserver-$version-py3-none-any.whl -C tmp - PYTHONPATH=tmp pytest tests - rm -rf tmp -} - post_install() { vlicense LICENSE }