commit:     b2c5aa195cc826dffc688a413431dc713193e618
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat May 29 20:44:45 2021 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat May 29 20:45:17 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b2c5aa19

dev-python/distlib: Enable py3.10

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 dev-python/distlib/distlib-0.3.2.ebuild            |  4 ++-
 dev-python/distlib/files/distlib-0.3.2-py310.patch | 29 ++++++++++++++++++++++
 2 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/dev-python/distlib/distlib-0.3.2.ebuild 
b/dev-python/distlib/distlib-0.3.2.ebuild
index f63f8868e8e..43cd8fc4d2e 100644
--- a/dev-python/distlib/distlib-0.3.2.ebuild
+++ b/dev-python/distlib/distlib-0.3.2.ebuild
@@ -4,7 +4,7 @@
 EAPI=7
 
 DISTUTILS_USE_SETUPTOOLS=no
-PYTHON_COMPAT=( python3_{7..9} pypy3 )
+PYTHON_COMPAT=( python3_{7..10} pypy3 )
 
 inherit distutils-r1 vcs-snapshot
 
@@ -38,6 +38,8 @@ src_prepare() {
 
        # use system pypiserver instead of broken bundled one
        eapply "${FILESDIR}"/distlib-0.3.2-system-pypiserver.py || die
+       # fix tests for py310
+       eapply "${FILESDIR}"/${P}-py310.patch
 
        # doesn't work with our patched pip
        sed -e '/PIP_AVAIL/s:True:False:' \

diff --git a/dev-python/distlib/files/distlib-0.3.2-py310.patch 
b/dev-python/distlib/files/distlib-0.3.2-py310.patch
new file mode 100644
index 00000000000..23c3dbbe027
--- /dev/null
+++ b/dev-python/distlib/files/distlib-0.3.2-py310.patch
@@ -0,0 +1,29 @@
+From 5a9540cf58fc020b0c6a1d5c23b9b93d1abd2eb0 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
+Date: Sat, 29 May 2021 22:08:57 +0200
+Subject: [PATCH] Fix test_is_compatible to fix Python 3.10 support
+
+On Python 3.10, PYVER is py310 which wrongly matches the original
+'py27' <= PYVER < 'py32' condition.  Replace it with explicit match
+against known Python versions in this range.  This is probably
+the simplest and the most future-proof solution to the problem at hand.
+---
+ tests/test_wheel.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/tests/test_wheel.py b/tests/test_wheel.py
+index 849e7c1..7c8f5ee 100644
+--- a/tests/test_wheel.py
++++ b/tests/test_wheel.py
+@@ -206,7 +206,7 @@ class WheelTestCase(DistlibTestCase):
+ 
+     def test_is_compatible(self):
+         fn = os.path.join(HERE, 'dummy-0.1-py27-none-any.whl')
+-        if 'py27' <= PYVER < 'py32':
++        if PYVER in ('py27', 'py30', 'py31'):
+             self.assertTrue(is_compatible(fn))
+             self.assertTrue(Wheel(fn).is_compatible())
+         # use actual wheel names from PyPI.
+-- 
+2.31.1
+

Reply via email to