Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/twisted/, dev-python/twisted/files/
Date: Tue, 08 Feb 2022 11:44:01
Message-Id: 1644320634.eb8d3cb0a2e53fd407e3a364b30a75366d7d8835.mgorny@gentoo
1 commit: eb8d3cb0a2e53fd407e3a364b30a75366d7d8835
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Tue Feb 8 11:18:33 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 8 11:43:54 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=eb8d3cb0
7
8 dev-python/twisted: Bump to 22.1.0
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/twisted/Manifest | 1 +
13 .../twisted/files/twisted-22.1.0-force-gtk3.patch | 67 +++++++++
14 dev-python/twisted/twisted-22.1.0.ebuild | 162 +++++++++++++++++++++
15 3 files changed, 230 insertions(+)
16
17 diff --git a/dev-python/twisted/Manifest b/dev-python/twisted/Manifest
18 index 3c5453df8fdc..06f514275b6a 100644
19 --- a/dev-python/twisted/Manifest
20 +++ b/dev-python/twisted/Manifest
21 @@ -1,2 +1,3 @@
22 DIST twisted-21.7.0.tar.gz 3895345 BLAKE2B 510165ad2933f07005e508df5a8bdf2863a7988c0f18fcc089e948d190c65aab32fc876d3120e311e91d6989f1ea2d8b3b5f5db4a9dfc63c38da56213f718728 SHA512 a946769a6bc6c72af26e7763b9e0675788f134b4d005ea89d935da1b1d5f60d92c84fdb2615e442e7da2b98291ee8a63d5236ec7ba72ef04ad3f847b092feecb
23 +DIST twisted-22.1.0.tar.gz 3883519 BLAKE2B 0b438481af94fbfe08c7470a71421e176ca4994efaf7144b2bd3bc7e69c774295e04831d5356af104d087d970856c1c153b30331cb1598226f83e761b624a53c SHA512 1db52865d00e07044bc755b25bef2fa260cf269a8b51512bec97a015fa484d0b331b41154b52f97b5e8c477d3e5ad1d003f5ac15c7361988d073d097c6e7355d
24 DIST twisted-regen-cache.gz 911 BLAKE2B ffd3fcda6c67ffe6fd3ef581c8d507548396b66ed0708e9a5c790095e579c0d5f0f71596acf05712989da2ddef2b8d437eca973bc4d80ef8a9fa852915f38305 SHA512 95a9b931c73017d16d1b5e6b41345dddffe62b6af1a8e93b5e40d06d3d15be17b0dd0181c767ffeeb791534d463764ef9e066fa6c2ee2ac4b53c86d1da8fce03
25
26 diff --git a/dev-python/twisted/files/twisted-22.1.0-force-gtk3.patch b/dev-python/twisted/files/twisted-22.1.0-force-gtk3.patch
27 new file mode 100644
28 index 000000000000..7c9f2d558d65
29 --- /dev/null
30 +++ b/dev-python/twisted/files/twisted-22.1.0-force-gtk3.patch
31 @@ -0,0 +1,67 @@
32 +From 9344f8cd80ecb2907dbfddfeeb8cc9ffdb50bc94 Mon Sep 17 00:00:00 2001
33 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
34 +Date: Sat, 22 May 2021 01:11:48 +0200
35 +Subject: [PATCH] Force using GTK+3 in twisted.internet.gireactor
36 +
37 +Modify twisted.internet.gireactor to explicitly request GTK+ version 3.
38 +Otherwise it uses the newest version installed which could be GTK+4
39 +that gireactor is currently incompatible with.
40 +---
41 + src/twisted/internet/gireactor.py | 3 +++
42 + src/twisted/internet/test/test_gireactor.py | 3 +++
43 + src/twisted/newsfragments/10200.bugfix | 1 +
44 + 3 files changed, 7 insertions(+)
45 + create mode 100644 src/twisted/newsfragments/10200.bugfix
46 +
47 +diff --git a/src/twisted/internet/gireactor.py b/src/twisted/internet/gireactor.py
48 +index e2d24b599..838fa982e 100644
49 +--- a/src/twisted/internet/gireactor.py
50 ++++ b/src/twisted/internet/gireactor.py
51 +@@ -21,6 +21,7 @@ On Python 3, pygobject v3.4 or later is required.
52 + """
53 +
54 +
55 ++import gi # type: ignore[import]
56 + import gi.pygtkcompat # type: ignore[import]
57 + from gi.repository import GLib # type: ignore[import]
58 +
59 +@@ -69,6 +70,7 @@ class GIReactor(_glibbase.GlibReactorBase):
60 + def __init__(self, useGtk=False):
61 + _gtk = None
62 + if useGtk is True:
63 ++ gi.require_version("Gtk", "3.0")
64 + from gi.repository import Gtk as _gtk
65 +
66 + _glibbase.GlibReactorBase.__init__(self, GLib, _gtk, useGtk=useGtk)
67 +@@ -113,6 +115,7 @@ class PortableGIReactor(_glibbase.PortableGlibReactorBase):
68 + def __init__(self, useGtk=False):
69 + _gtk = None
70 + if useGtk is True:
71 ++ gi.require_version("Gtk", "3.0")
72 + from gi.repository import Gtk as _gtk
73 +
74 + _glibbase.PortableGlibReactorBase.__init__(self, GLib, _gtk, useGtk=useGtk)
75 +diff --git a/src/twisted/internet/test/test_gireactor.py b/src/twisted/internet/test/test_gireactor.py
76 +index c25ada63f..3bb88a07f 100644
77 +--- a/src/twisted/internet/test/test_gireactor.py
78 ++++ b/src/twisted/internet/test/test_gireactor.py
79 +@@ -26,6 +26,9 @@ else:
80 + gtk3reactor = None
81 + else:
82 + gtk3reactor = _gtk3reactor
83 ++ import gi # type: ignore[import]
84 ++
85 ++ gi.require_version("Gtk", "3.0")
86 + from gi.repository import Gtk
87 +
88 + from twisted.internet.error import ReactorAlreadyRunning
89 +diff --git a/src/twisted/newsfragments/10200.bugfix b/src/twisted/newsfragments/10200.bugfix
90 +new file mode 100644
91 +index 000000000..7afb343be
92 +--- /dev/null
93 ++++ b/src/twisted/newsfragments/10200.bugfix
94 +@@ -0,0 +1 @@
95 ++twisted.internet.gireactor was fixed to force GTK+3 in order to fix use of incompatible GTK+4 API when installed
96 +--
97 +2.35.1
98 +
99
100 diff --git a/dev-python/twisted/twisted-22.1.0.ebuild b/dev-python/twisted/twisted-22.1.0.ebuild
101 new file mode 100644
102 index 000000000000..de7efb1a47ce
103 --- /dev/null
104 +++ b/dev-python/twisted/twisted-22.1.0.ebuild
105 @@ -0,0 +1,162 @@
106 +# Copyright 1999-2022 Gentoo Authors
107 +# Distributed under the terms of the GNU General Public License v2
108 +
109 +EAPI=8
110 +
111 +PYTHON_COMPAT=( python3_{8..10} )
112 +PYTHON_REQ_USE="threads(+)"
113 +
114 +inherit distutils-r1 virtualx
115 +
116 +DESCRIPTION="An asynchronous networking framework written in Python"
117 +HOMEPAGE="https://www.twistedmatrix.com/trac/"
118 +SRC_URI="
119 + https://github.com/twisted/twisted/archive/${P}.tar.gz
120 + https://dev.gentoo.org/~mgorny/dist/twisted-regen-cache.gz"
121 +S=${WORKDIR}/${PN}-${P}
122 +
123 +LICENSE="MIT"
124 +SLOT="0"
125 +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86"
126 +IUSE="conch crypt http2 serial test"
127 +RESTRICT="!test? ( test )"
128 +
129 +RDEPEND="
130 + >=dev-python/attrs-19.2.0[${PYTHON_USEDEP}]
131 + >=dev-python/automat-0.3.0[${PYTHON_USEDEP}]
132 + >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}]
133 + >=dev-python/hyperlink-17.1.1[${PYTHON_USEDEP}]
134 + >=dev-python/incremental-21.3.0[${PYTHON_USEDEP}]
135 + >=dev-python/pyhamcrest-1.9.0[${PYTHON_USEDEP}]
136 + >=dev-python/typing-extensions-3.6.5[${PYTHON_USEDEP}]
137 + >=dev-python/zope-interface-4.4.2[${PYTHON_USEDEP}]
138 + conch? (
139 + >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}]
140 + dev-python/bcrypt[${PYTHON_USEDEP}]
141 + >=dev-python/cryptography-1.5.0[${PYTHON_USEDEP}]
142 + dev-python/pyasn1[${PYTHON_USEDEP}]
143 + )
144 + crypt? (
145 + >=dev-python/pyopenssl-16.0.0[${PYTHON_USEDEP}]
146 + dev-python/service_identity[${PYTHON_USEDEP}]
147 + >=dev-python/idna-0.6[${PYTHON_USEDEP}]
148 + )
149 + serial? ( >=dev-python/pyserial-3.0[${PYTHON_USEDEP}] )
150 + http2? (
151 + >=dev-python/h2-3.0.0[${PYTHON_USEDEP}]
152 + <dev-python/h2-4.0.0[${PYTHON_USEDEP}]
153 + >=dev-python/priority-1.1.0[${PYTHON_USEDEP}]
154 + <dev-python/priority-2.0[${PYTHON_USEDEP}]
155 + )
156 +"
157 +BDEPEND="
158 + >=dev-python/incremental-21.3.0[${PYTHON_USEDEP}]
159 + test? (
160 + >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}]
161 + dev-python/bcrypt[${PYTHON_USEDEP}]
162 + >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}]
163 + dev-python/cython-test-exception-raiser[${PYTHON_USEDEP}]
164 + dev-python/idna[${PYTHON_USEDEP}]
165 + dev-python/pyasn1[${PYTHON_USEDEP}]
166 + dev-python/pyserial[${PYTHON_USEDEP}]
167 + net-misc/openssh
168 + $(python_gen_cond_dep '
169 + dev-python/gmpy[${PYTHON_USEDEP}]
170 + ' 'python*')
171 + !alpha? ( !hppa? ( !ia64? (
172 + >=dev-python/cryptography-0.9.1[${PYTHON_USEDEP}]
173 + >=dev-python/pyopenssl-0.13[${PYTHON_USEDEP}]
174 + dev-python/service_identity[${PYTHON_USEDEP}]
175 + ) ) )
176 + )
177 +"
178 +
179 +PATCHES=(
180 + # https://twistedmatrix.com/trac/ticket/10200
181 + "${FILESDIR}/${P}-force-gtk3.patch"
182 +)
183 +
184 +python_prepare_all() {
185 + # upstream test for making releases; not very useful and requires
186 + # sphinx (including on py2)
187 + rm src/twisted/python/test/test_release.py || die
188 +
189 + # puts system in EMFILE state, then the exception handler may fail
190 + # trying to open more files due to some gi magic
191 + sed -e '/SKIP_EMFILE/s:False:True:' \
192 + -i src/twisted/internet/test/test_tcp.py || die
193 +
194 + # multicast tests fail within network-sandbox
195 + sed -e 's:test_joinLeave:_&:' \
196 + -e 's:test_loopback:_&:' \
197 + -e 's:test_multiListen:_&:' \
198 + -e 's:test_multicast:_&:' \
199 + -i src/twisted/test/test_udp.py || die
200 +
201 + # These tests rely on warnings which seems work unreliably between python versions
202 + sed -e 's:test_currentEUID:_&:' \
203 + -e 's:test_currentUID:_&:' -i src/twisted/python/test/test_util.py || die
204 +
205 + distutils-r1_python_prepare_all
206 +}
207 +
208 +src_test() {
209 + # the test suite handles missing file & failing ioctl()s gracefully
210 + # but not permission errors from sandbox
211 + addwrite /dev/net/tun
212 + virtx distutils-r1_src_test
213 +}
214 +
215 +python_test() {
216 + # TODO: upstream seems to override our build paths
217 + distutils_install_for_testing
218 +
219 + "${EPYTHON}" -m twisted.trial twisted ||
220 + die "Tests failed with ${EPYTHON}"
221 +}
222 +
223 +python_install() {
224 + distutils-r1_python_install
225 +
226 + # own the dropin.cache so we don't leave orphans
227 + > "${D}$(python_get_sitedir)"/twisted/plugins/dropin.cache || die
228 +
229 + python_doscript "${WORKDIR}"/twisted-regen-cache
230 +}
231 +
232 +python_install_all() {
233 + distutils-r1_python_install_all
234 +
235 + newconfd "${FILESDIR}/twistd.conf" twistd
236 + newinitd "${FILESDIR}/twistd.init" twistd
237 +}
238 +
239 +python_postinst() {
240 + twisted-regen-cache || die
241 +}
242 +
243 +pkg_postinst() {
244 + python_foreach_impl python_postinst
245 +
246 + einfo "Install complete"
247 + if use test ; then
248 + einfo ""
249 + einfo "Some tests have been disabled during testing due to"
250 + einfo "known incompatibilities with the emerge sandboxes and/or"
251 + einfo "not runnable as the root user."
252 + einfo "For a complete test suite run on the code."
253 + einfo "Run the tests as a normal user for each python it is installed to."
254 + einfo " ie: $ python3.6 /usr/bin/trial twisted"
255 + fi
256 +}
257 +
258 +python_postrm() {
259 + rm -f "${ROOT}$(python_get_sitedir)/twisted/plugins/dropin.cache" || die
260 +}
261 +
262 +pkg_postrm() {
263 + # if we're removing the last version, remove the cache file
264 + if [[ ! ${REPLACING_VERSIONS} ]]; then
265 + python_foreach_impl python_postrm
266 + fi
267 +}