1 |
commit: 35339ca7928eeb3ee59b381d1bb3d715055e3e73 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 13 06:59:25 2022 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 13 09:07:56 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=35339ca7 |
7 |
|
8 |
dev-python/twisted: Enable py3.11 |
9 |
|
10 |
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> |
11 |
|
12 |
.../twisted/files/twisted-22.4.0-py311.patch | 55 ++++++++++++++++++++++ |
13 |
dev-python/twisted/twisted-22.4.0.ebuild | 40 ++++++++++------ |
14 |
2 files changed, 80 insertions(+), 15 deletions(-) |
15 |
|
16 |
diff --git a/dev-python/twisted/files/twisted-22.4.0-py311.patch b/dev-python/twisted/files/twisted-22.4.0-py311.patch |
17 |
new file mode 100644 |
18 |
index 000000000000..ed8ded87d4de |
19 |
--- /dev/null |
20 |
+++ b/dev-python/twisted/files/twisted-22.4.0-py311.patch |
21 |
@@ -0,0 +1,55 @@ |
22 |
+From 074fc742a699278ea5266b34aace1e34049b3de3 Mon Sep 17 00:00:00 2001 |
23 |
+From: Colin Watson <cjwatson@×××××××××.com> |
24 |
+Date: Sat, 23 Apr 2022 22:29:07 +0100 |
25 |
+Subject: [PATCH] Implement twisted.python.failure._Code.co_positions |
26 |
+ |
27 |
+This is needed for compatibility with Python 3.11. |
28 |
+--- |
29 |
+ src/twisted/newsfragments/10336.bugfix | 1 + |
30 |
+ src/twisted/python/failure.py | 5 ++++- |
31 |
+ src/twisted/test/test_failure.py | 1 + |
32 |
+ 3 files changed, 6 insertions(+), 1 deletion(-) |
33 |
+ create mode 100644 src/twisted/newsfragments/10336.bugfix |
34 |
+ |
35 |
+diff --git a/src/twisted/newsfragments/10336.bugfix b/src/twisted/newsfragments/10336.bugfix |
36 |
+new file mode 100644 |
37 |
+index 00000000000..a7ffab3627d |
38 |
+--- /dev/null |
39 |
++++ b/src/twisted/newsfragments/10336.bugfix |
40 |
+@@ -0,0 +1 @@ |
41 |
++Implement twisted.python.failure._Code.co_positions for compatibility with Python 3.11. |
42 |
+diff --git a/src/twisted/python/failure.py b/src/twisted/python/failure.py |
43 |
+index 6471e7bca59..c5a359e405b 100644 |
44 |
+--- a/src/twisted/python/failure.py |
45 |
++++ b/src/twisted/python/failure.py |
46 |
+@@ -130,7 +130,7 @@ def _Traceback(stackFrames, tbFrames): |
47 |
+ |
48 |
+ |
49 |
+ # The set of attributes for _TracebackFrame, _Frame and _Code were taken from |
50 |
+-# https://docs.python.org/3.10/library/inspect.html Other Pythons may have a |
51 |
++# https://docs.python.org/3.11/library/inspect.html Other Pythons may have a |
52 |
+ # few more attributes that should be added if needed. |
53 |
+ class _TracebackFrame: |
54 |
+ """ |
55 |
+@@ -202,6 +202,9 @@ def __init__(self, name, filename): |
56 |
+ self.co_nlocals = 0 |
57 |
+ self.co_stacksize = 0 |
58 |
+ |
59 |
++ def co_positions(self): |
60 |
++ return ((None, None, None, None),) |
61 |
++ |
62 |
+ |
63 |
+ _inlineCallbacksExtraneous = [] |
64 |
+ |
65 |
+diff --git a/src/twisted/test/test_failure.py b/src/twisted/test/test_failure.py |
66 |
+index 6dd7c682bf9..6fd82c868ec 100644 |
67 |
+--- a/src/twisted/test/test_failure.py |
68 |
++++ b/src/twisted/test/test_failure.py |
69 |
+@@ -825,6 +825,7 @@ def test_fakeCodeAttributes(self): |
70 |
+ self.assertIsInstance(code.co_nlocals, int) |
71 |
+ self.assertIsInstance(code.co_stacksize, int) |
72 |
+ self.assertIsInstance(code.co_varnames, list) |
73 |
++ self.assertIsInstance(code.co_positions(), tuple) |
74 |
+ |
75 |
+ def test_fakeTracebackFrame(self): |
76 |
+ """ |
77 |
|
78 |
diff --git a/dev-python/twisted/twisted-22.4.0.ebuild b/dev-python/twisted/twisted-22.4.0.ebuild |
79 |
index 65b454179630..4b5c0125c4b7 100644 |
80 |
--- a/dev-python/twisted/twisted-22.4.0.ebuild |
81 |
+++ b/dev-python/twisted/twisted-22.4.0.ebuild |
82 |
@@ -4,7 +4,7 @@ |
83 |
EAPI=8 |
84 |
|
85 |
DISTUTILS_USE_PEP517=setuptools |
86 |
-PYTHON_COMPAT=( python3_{8..10} pypy3 ) |
87 |
+PYTHON_COMPAT=( python3_{8..11} pypy3 ) |
88 |
PYTHON_REQ_USE="threads(+)" |
89 |
|
90 |
inherit distutils-r1 virtualx |
91 |
@@ -54,28 +54,32 @@ RDEPEND=" |
92 |
BDEPEND=" |
93 |
>=dev-python/incremental-21.3.0[${PYTHON_USEDEP}] |
94 |
test? ( |
95 |
- >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}] |
96 |
- dev-python/bcrypt[${PYTHON_USEDEP}] |
97 |
- >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}] |
98 |
- dev-python/cython-test-exception-raiser[${PYTHON_USEDEP}] |
99 |
- dev-python/idna[${PYTHON_USEDEP}] |
100 |
- dev-python/pyasn1[${PYTHON_USEDEP}] |
101 |
- dev-python/pyserial[${PYTHON_USEDEP}] |
102 |
- net-misc/openssh |
103 |
+ $(python_gen_cond_dep ' |
104 |
+ >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}] |
105 |
+ dev-python/bcrypt[${PYTHON_USEDEP}] |
106 |
+ >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}] |
107 |
+ dev-python/cython-test-exception-raiser[${PYTHON_USEDEP}] |
108 |
+ dev-python/idna[${PYTHON_USEDEP}] |
109 |
+ dev-python/pyasn1[${PYTHON_USEDEP}] |
110 |
+ dev-python/pyserial[${PYTHON_USEDEP}] |
111 |
+ net-misc/openssh |
112 |
+ !alpha? ( !hppa? ( !ia64? ( |
113 |
+ >=dev-python/cryptography-0.9.1[${PYTHON_USEDEP}] |
114 |
+ >=dev-python/pyopenssl-0.13[${PYTHON_USEDEP}] |
115 |
+ dev-python/service_identity[${PYTHON_USEDEP}] |
116 |
+ ) ) ) |
117 |
+ ' python3_{8..10} pypy3) |
118 |
$(python_gen_cond_dep ' |
119 |
dev-python/gmpy[${PYTHON_USEDEP}] |
120 |
- ' 'python*') |
121 |
- !alpha? ( !hppa? ( !ia64? ( |
122 |
- >=dev-python/cryptography-0.9.1[${PYTHON_USEDEP}] |
123 |
- >=dev-python/pyopenssl-0.13[${PYTHON_USEDEP}] |
124 |
- dev-python/service_identity[${PYTHON_USEDEP}] |
125 |
- ) ) ) |
126 |
+ ' python3_{8..10}) |
127 |
) |
128 |
" |
129 |
|
130 |
PATCHES=( |
131 |
# https://twistedmatrix.com/trac/ticket/10200 |
132 |
"${FILESDIR}/${PN}-22.1.0-force-gtk3.patch" |
133 |
+ # https://github.com/twisted/twisted/pull/1723 |
134 |
+ "${FILESDIR}/${P}-py311.patch" |
135 |
) |
136 |
|
137 |
python_prepare_all() { |
138 |
@@ -114,6 +118,12 @@ src_test() { |
139 |
} |
140 |
|
141 |
python_test() { |
142 |
+ # please keep in sync with python_gen_cond_dep! |
143 |
+ if ! has "${EPYTHON}" python3_{8..10} pypy3; then |
144 |
+ einfo "Skipping tests on ${EPYTHON} (xfail)" |
145 |
+ return |
146 |
+ fi |
147 |
+ |
148 |
"${EPYTHON}" -m twisted.trial twisted || |
149 |
die "Tests failed with ${EPYTHON}" |
150 |
} |