diff options
author | Michał Górny <mgorny@gentoo.org> | 2022-05-13 08:59:25 +0200 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2022-05-13 11:07:56 +0200 |
commit | 35339ca7928eeb3ee59b381d1bb3d715055e3e73 (patch) | |
tree | cb19b76e49cd3dd0b20e346af740e71d0f912bc7 /dev-python/twisted | |
parent | dev-python/incremental: Enable py3.11 (diff) | |
download | gentoo-35339ca7928eeb3ee59b381d1bb3d715055e3e73.tar.gz gentoo-35339ca7928eeb3ee59b381d1bb3d715055e3e73.tar.bz2 gentoo-35339ca7928eeb3ee59b381d1bb3d715055e3e73.zip |
dev-python/twisted: Enable py3.11
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/twisted')
-rw-r--r-- | dev-python/twisted/files/twisted-22.4.0-py311.patch | 55 | ||||
-rw-r--r-- | dev-python/twisted/twisted-22.4.0.ebuild | 40 |
2 files changed, 80 insertions, 15 deletions
diff --git a/dev-python/twisted/files/twisted-22.4.0-py311.patch b/dev-python/twisted/files/twisted-22.4.0-py311.patch new file mode 100644 index 000000000000..ed8ded87d4de --- /dev/null +++ b/dev-python/twisted/files/twisted-22.4.0-py311.patch @@ -0,0 +1,55 @@ +From 074fc742a699278ea5266b34aace1e34049b3de3 Mon Sep 17 00:00:00 2001 +From: Colin Watson <cjwatson@canonical.com> +Date: Sat, 23 Apr 2022 22:29:07 +0100 +Subject: [PATCH] Implement twisted.python.failure._Code.co_positions + +This is needed for compatibility with Python 3.11. +--- + src/twisted/newsfragments/10336.bugfix | 1 + + src/twisted/python/failure.py | 5 ++++- + src/twisted/test/test_failure.py | 1 + + 3 files changed, 6 insertions(+), 1 deletion(-) + create mode 100644 src/twisted/newsfragments/10336.bugfix + +diff --git a/src/twisted/newsfragments/10336.bugfix b/src/twisted/newsfragments/10336.bugfix +new file mode 100644 +index 00000000000..a7ffab3627d +--- /dev/null ++++ b/src/twisted/newsfragments/10336.bugfix +@@ -0,0 +1 @@ ++Implement twisted.python.failure._Code.co_positions for compatibility with Python 3.11. +diff --git a/src/twisted/python/failure.py b/src/twisted/python/failure.py +index 6471e7bca59..c5a359e405b 100644 +--- a/src/twisted/python/failure.py ++++ b/src/twisted/python/failure.py +@@ -130,7 +130,7 @@ def _Traceback(stackFrames, tbFrames): + + + # The set of attributes for _TracebackFrame, _Frame and _Code were taken from +-# https://docs.python.org/3.10/library/inspect.html Other Pythons may have a ++# https://docs.python.org/3.11/library/inspect.html Other Pythons may have a + # few more attributes that should be added if needed. + class _TracebackFrame: + """ +@@ -202,6 +202,9 @@ def __init__(self, name, filename): + self.co_nlocals = 0 + self.co_stacksize = 0 + ++ def co_positions(self): ++ return ((None, None, None, None),) ++ + + _inlineCallbacksExtraneous = [] + +diff --git a/src/twisted/test/test_failure.py b/src/twisted/test/test_failure.py +index 6dd7c682bf9..6fd82c868ec 100644 +--- a/src/twisted/test/test_failure.py ++++ b/src/twisted/test/test_failure.py +@@ -825,6 +825,7 @@ def test_fakeCodeAttributes(self): + self.assertIsInstance(code.co_nlocals, int) + self.assertIsInstance(code.co_stacksize, int) + self.assertIsInstance(code.co_varnames, list) ++ self.assertIsInstance(code.co_positions(), tuple) + + def test_fakeTracebackFrame(self): + """ diff --git a/dev-python/twisted/twisted-22.4.0.ebuild b/dev-python/twisted/twisted-22.4.0.ebuild index 65b454179630..4b5c0125c4b7 100644 --- a/dev-python/twisted/twisted-22.4.0.ebuild +++ b/dev-python/twisted/twisted-22.4.0.ebuild @@ -4,7 +4,7 @@ EAPI=8 DISTUTILS_USE_PEP517=setuptools -PYTHON_COMPAT=( python3_{8..10} pypy3 ) +PYTHON_COMPAT=( python3_{8..11} pypy3 ) PYTHON_REQ_USE="threads(+)" inherit distutils-r1 virtualx @@ -54,28 +54,32 @@ RDEPEND=" BDEPEND=" >=dev-python/incremental-21.3.0[${PYTHON_USEDEP}] test? ( - >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}] - dev-python/bcrypt[${PYTHON_USEDEP}] - >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}] - dev-python/cython-test-exception-raiser[${PYTHON_USEDEP}] - dev-python/idna[${PYTHON_USEDEP}] - dev-python/pyasn1[${PYTHON_USEDEP}] - dev-python/pyserial[${PYTHON_USEDEP}] - net-misc/openssh + $(python_gen_cond_dep ' + >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}] + dev-python/bcrypt[${PYTHON_USEDEP}] + >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}] + dev-python/cython-test-exception-raiser[${PYTHON_USEDEP}] + dev-python/idna[${PYTHON_USEDEP}] + dev-python/pyasn1[${PYTHON_USEDEP}] + dev-python/pyserial[${PYTHON_USEDEP}] + net-misc/openssh + !alpha? ( !hppa? ( !ia64? ( + >=dev-python/cryptography-0.9.1[${PYTHON_USEDEP}] + >=dev-python/pyopenssl-0.13[${PYTHON_USEDEP}] + dev-python/service_identity[${PYTHON_USEDEP}] + ) ) ) + ' python3_{8..10} pypy3) $(python_gen_cond_dep ' dev-python/gmpy[${PYTHON_USEDEP}] - ' 'python*') - !alpha? ( !hppa? ( !ia64? ( - >=dev-python/cryptography-0.9.1[${PYTHON_USEDEP}] - >=dev-python/pyopenssl-0.13[${PYTHON_USEDEP}] - dev-python/service_identity[${PYTHON_USEDEP}] - ) ) ) + ' python3_{8..10}) ) " PATCHES=( # https://twistedmatrix.com/trac/ticket/10200 "${FILESDIR}/${PN}-22.1.0-force-gtk3.patch" + # https://github.com/twisted/twisted/pull/1723 + "${FILESDIR}/${P}-py311.patch" ) python_prepare_all() { @@ -114,6 +118,12 @@ src_test() { } python_test() { + # please keep in sync with python_gen_cond_dep! + if ! has "${EPYTHON}" python3_{8..10} pypy3; then + einfo "Skipping tests on ${EPYTHON} (xfail)" + return + fi + "${EPYTHON}" -m twisted.trial twisted || die "Tests failed with ${EPYTHON}" } |