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