commit: 129f9f44662460d2793cf0f55304ca3b8d3346ab Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Sat Jul 5 11:04:06 2025 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Tue Jul 8 06:03:04 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=129f9f44
dev-python/ensurepip-wheel: Switch to building from source Build the installed wheel from source rather than fetching the upstream wheel. This is going to make it easier to patch bugs, and it enables users to apply user patches. Additionally, we are effectively extending test coverage, since dev-python/wheel is only testing the unbundled variant. Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> Part-of: https://github.com/gentoo/gentoo/pull/42882 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> dev-python/ensurepip-wheel/Manifest | 1 + .../ensurepip-wheel-0.45.1-r1.ebuild | 69 +++++++++++++ .../ensurepip-wheel/files/wheel-0.45.1-test.patch | 113 +++++++++++++++++++++ dev-python/ensurepip-wheel/metadata.xml | 2 + 4 files changed, 185 insertions(+) diff --git a/dev-python/ensurepip-wheel/Manifest b/dev-python/ensurepip-wheel/Manifest index 667251597183..449c21e74d40 100644 --- a/dev-python/ensurepip-wheel/Manifest +++ b/dev-python/ensurepip-wheel/Manifest @@ -1 +1,2 @@ DIST wheel-0.45.1-py3-none-any.whl 72494 BLAKE2B f87dc394465368d06eb57c1697d45250ac3e04a15841ab018b1fc5ca5bb8eaa731108c61e6e2a018b6d2a6fa3ea66e5b182d6041c5143d03f7b2b92bdb2e71c6 SHA512 86c16248ec804ee0ac95d43b03d47351dceb534d0cdc4025ca1eb073e39e539de44c870b9261f0373144e1537f0e42675a759a318a8d5d346bbd9efcb704061d +DIST wheel-0.45.1.tar.gz 107545 BLAKE2B 13c8d60a2e39ded3d911c9e03915b01bda201f7e8cd6de456484ce6eeb2a990861a01f26e5d9f2ac4ca0ab2b6d0fea9db437d6f82cb39db9b1059c3c53202ec0 SHA512 df45f00e9eaeae2f27f813f31591590c961da2f6bff15bba6fb2a14d529c221f39b29894b8da408fe49cd4b760840a0e05c4baef377ccfacd9983c0bba83d6d8 diff --git a/dev-python/ensurepip-wheel/ensurepip-wheel-0.45.1-r1.ebuild b/dev-python/ensurepip-wheel/ensurepip-wheel-0.45.1-r1.ebuild new file mode 100644 index 000000000000..a65e1d9d1d1c --- /dev/null +++ b/dev-python/ensurepip-wheel/ensurepip-wheel-0.45.1-r1.ebuild @@ -0,0 +1,69 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=flit +PYPI_PN=${PN#ensurepip-} +# PYTHON_COMPAT used only for testing +PYTHON_COMPAT=( python3_{11..14} python3_{13,14}t pypy3_11 ) + +inherit distutils-r1 pypi + +DESCRIPTION="Shared wheel wheel for use in pip tests" +HOMEPAGE=" + https://github.com/pypa/wheel/ + https://pypi.org/project/wheel/ +" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" + +BDEPEND=" + test? ( + dev-python/setuptools[${PYTHON_USEDEP}] + ) +" + +# xdist is slightly flaky here +EPYTEST_PLUGINS=( pytest-rerunfailures ) +EPYTEST_XDIST=1 +distutils_enable_tests pytest + +PATCHES=( + # https://github.com/pypa/wheel/pull/651 + "${FILESDIR}/wheel-0.45.1-test.patch" +) + +python_compile() { + # If we're testing, install for all implementations. + # If we're not, just get one wheel built. + if use test || [[ -z ${DISTUTILS_WHEEL_PATH} ]]; then + distutils-r1_python_compile + fi +} + +python_test() { + local EPYTEST_DESELECT=( + # fails if any setuptools plugin imported the module first + tests/test_bdist_wheel.py::test_deprecated_import + + # broken by setuptools license changes + # upstream removed the tests already + tests/test_bdist_wheel.py::test_licenses_default + tests/test_bdist_wheel.py::test_licenses_deprecated + tests/test_bdist_wheel.py::test_licenses_override + ) + + epytest --reruns=5 +} + +src_install() { + if [[ ${DISTUTILS_WHEEL_PATH} != *py3-none-any.whl ]]; then + die "Non-pure wheel produced?! ${DISTUTILS_WHEEL_PATH}" + fi + # TODO: compress it? + insinto /usr/lib/python/ensurepip + doins "${DISTUTILS_WHEEL_PATH}" +} diff --git a/dev-python/ensurepip-wheel/files/wheel-0.45.1-test.patch b/dev-python/ensurepip-wheel/files/wheel-0.45.1-test.patch new file mode 100644 index 000000000000..bb99eccdd0fa --- /dev/null +++ b/dev-python/ensurepip-wheel/files/wheel-0.45.1-test.patch @@ -0,0 +1,113 @@ +From 36877e99122e8df90d4aa41d414999857d6d852d Mon Sep 17 00:00:00 2001 +From: shenxianpeng <[email protected]> +Date: Sun, 16 Mar 2025 01:35:32 +0800 +Subject: [PATCH] Fixed test failures (#651) + +--- a/tests/test_bdist_wheel.py ++++ b/tests/test_bdist_wheel.py +@@ -79,9 +79,9 @@ def test_no_scripts(wheel_paths): + + + def test_unicode_record(wheel_paths): +- path = next(path for path in wheel_paths if "unicode.dist" in path) ++ path = next(path for path in wheel_paths if "unicode_dist" in path) + with ZipFile(path) as zf: +- record = zf.read("unicode.dist-0.1.dist-info/RECORD") ++ record = zf.read("unicode_dist-0.1.dist-info/RECORD") + + assert "åäö_日本語.py".encode() in record + +--- a/tests/test_tagopt.py ++++ b/tests/test_tagopt.py +@@ -14,7 +14,7 @@ SETUP_PY = """\ + from setuptools import setup, Extension + + setup( +- name="Test", ++ name="test", + version="1.0", + author_email="[email protected]", + py_modules=["test"], +@@ -63,7 +63,7 @@ def test_default_tag(temp_pkg): + assert dist_dir.is_dir() + wheels = list(dist_dir.iterdir()) + assert len(wheels) == 1 +- assert wheels[0].name == f"Test-1.0-py{sys.version_info[0]}-none-any.whl" ++ assert wheels[0].name == f"test-1.0-py{sys.version_info[0]}-none-any.whl" + assert wheels[0].suffix == ".whl" + + +@@ -76,7 +76,7 @@ def test_build_number(temp_pkg): + assert dist_dir.is_dir() + wheels = list(dist_dir.iterdir()) + assert len(wheels) == 1 +- assert wheels[0].name == f"Test-1.0-1-py{sys.version_info[0]}-none-any.whl" ++ assert wheels[0].name == f"test-1.0-1-py{sys.version_info[0]}-none-any.whl" + assert wheels[0].suffix == ".whl" + + +@@ -89,7 +89,7 @@ def test_explicit_tag(temp_pkg): + assert dist_dir.is_dir() + wheels = list(dist_dir.iterdir()) + assert len(wheels) == 1 +- assert wheels[0].name.startswith("Test-1.0-py32-") ++ assert wheels[0].name.startswith("test-1.0-py32-") + assert wheels[0].suffix == ".whl" + + +@@ -101,7 +101,7 @@ def test_universal_tag(temp_pkg): + assert dist_dir.is_dir() + wheels = list(dist_dir.iterdir()) + assert len(wheels) == 1 +- assert wheels[0].name.startswith("Test-1.0-py2.py3-") ++ assert wheels[0].name.startswith("test-1.0-py2.py3-") + assert wheels[0].suffix == ".whl" + + +@@ -114,7 +114,7 @@ def test_universal_beats_explicit_tag(temp_pkg): + assert dist_dir.is_dir() + wheels = list(dist_dir.iterdir()) + assert len(wheels) == 1 +- assert wheels[0].name.startswith("Test-1.0-py2.py3-") ++ assert wheels[0].name.startswith("test-1.0-py2.py3-") + assert wheels[0].suffix == ".whl" + + +@@ -129,7 +129,7 @@ def test_universal_in_setup_cfg(temp_pkg): + assert dist_dir.is_dir() + wheels = list(dist_dir.iterdir()) + assert len(wheels) == 1 +- assert wheels[0].name.startswith("Test-1.0-py2.py3-") ++ assert wheels[0].name.startswith("test-1.0-py2.py3-") + assert wheels[0].suffix == ".whl" + + +@@ -144,7 +144,7 @@ def test_pythontag_in_setup_cfg(temp_pkg): + assert dist_dir.is_dir() + wheels = list(dist_dir.iterdir()) + assert len(wheels) == 1 +- assert wheels[0].name.startswith("Test-1.0-py32-") ++ assert wheels[0].name.startswith("test-1.0-py32-") + assert wheels[0].suffix == ".whl" + + +@@ -157,7 +157,7 @@ def test_legacy_wheel_section_in_setup_cfg(temp_pkg): + assert dist_dir.is_dir() + wheels = list(dist_dir.iterdir()) + assert len(wheels) == 1 +- assert wheels[0].name.startswith("Test-1.0-py2.py3-") ++ assert wheels[0].name.startswith("test-1.0-py2.py3-") + assert wheels[0].suffix == ".whl" + + +--- a/tests/testdata/unicode.dist/setup.py ++++ b/tests/testdata/unicode.dist/setup.py +@@ -3,7 +3,7 @@ from __future__ import annotations + from setuptools import setup + + setup( +- name="unicode.dist", ++ name="unicode_dist", + version="0.1", + description="A testing distribution \N{SNOWMAN}", + packages=["unicodedist"], diff --git a/dev-python/ensurepip-wheel/metadata.xml b/dev-python/ensurepip-wheel/metadata.xml index 06e0e8257eb0..2bb9fa8c897f 100644 --- a/dev-python/ensurepip-wheel/metadata.xml +++ b/dev-python/ensurepip-wheel/metadata.xml @@ -3,9 +3,11 @@ <pkgmetadata> <maintainer type="project"> <email>[email protected]</email> + <name>Python</name> </maintainer> <stabilize-allarches/> <upstream> <remote-id type="pypi">wheel</remote-id> + <remote-id type="github">pypa/wheel</remote-id> </upstream> </pkgmetadata>
