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/files/, dev-python/twisted/
Date: Fri, 30 Jul 2021 18:14:34
Message-Id: 1627668856.c7eead8493f6ba9e8c373341c8cf86403ad490ef.mgorny@gentoo
1 commit: c7eead8493f6ba9e8c373341c8cf86403ad490ef
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jul 30 15:48:03 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 30 18:14:16 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c7eead84
7
8 dev-python/twisted: Remove old
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/twisted/Manifest | 2 -
13 .../twisted/files/twisted-19.10.0-py38-cgi.patch | 41 ----
14 .../twisted/files/twisted-19.10.0-py38.patch | 110 ---------
15 .../twisted/files/twisted-19.10.0-py39-b64.patch | 165 -------------
16 .../twisted/files/twisted-20.3.0-py38-cgi.patch | 259 ---------------------
17 .../twisted/files/twisted-20.3.0-py38-hmac.patch | 94 --------
18 .../twisted/files/twisted-20.3.0-py39-b64.patch | 158 -------------
19 .../files/twisted-20.3.0-py39-combined.patch | 115 ---------
20 dev-python/twisted/twisted-19.10.0.ebuild | 194 ---------------
21 dev-python/twisted/twisted-20.3.0.ebuild | 190 ---------------
22 10 files changed, 1328 deletions(-)
23
24 diff --git a/dev-python/twisted/Manifest b/dev-python/twisted/Manifest
25 index 0ed1eeac5fb..8f648038b16 100644
26 --- a/dev-python/twisted/Manifest
27 +++ b/dev-python/twisted/Manifest
28 @@ -1,5 +1,3 @@
29 -DIST Twisted-19.10.0.tar.bz2 3118485 BLAKE2B a0d532b67177aa017e463bf823d7842d4f6ff694f78cd7600865718ffe861023a53ea6a922f7de232133edba26f5255074d7ef277ce8f3bdf02d556ccf4abf41 SHA512 de8d7fd0b2081cebeff68b060c8469377011648bc563a94a993d3530fb007ed42c3a54925c9a10c465ee7a3065cc9108ace12d10d358223fab13494becb9ac4b
30 -DIST Twisted-20.3.0.tar.bz2 3127793 BLAKE2B 2e85fc3ec26d89e563c9e79a5d2adea81ff1745d18f0f92b8d45ae3729fbddf09998664257880372c7a4caeb5977c5cad7c863596b8c27ad7890275cead9f763 SHA512 1b850e5fc21a3630ead4c2cc3622c16e78bb3be38ab11d021779b7ce3d3c30acc4e19d79c7791a5fce6c5c6e09c2baa349901dffe952de67dd98eec419846365
31 DIST twisted-21.2.0.tar.gz 3882978 BLAKE2B ba37572b0f9eadf2962a2730e4c2c0ed65f582b11b3350034660a2c53c5cd0892b19867d19e0201d4808c09fca621dbe540d153dc6c7d5827d45d2423d19d28b SHA512 fa743dcf22f3c17dfd17f39b7df0cc31fb8ce3e989478ada9a026424ec2de35e6a403ef35acdef5905eed008d42e3c2fee6b7ccdda433e6c250f1feaa83ea8a4
32 DIST twisted-21.7.0.tar.gz 3895345 BLAKE2B 510165ad2933f07005e508df5a8bdf2863a7988c0f18fcc089e948d190c65aab32fc876d3120e311e91d6989f1ea2d8b3b5f5db4a9dfc63c38da56213f718728 SHA512 a946769a6bc6c72af26e7763b9e0675788f134b4d005ea89d935da1b1d5f60d92c84fdb2615e442e7da2b98291ee8a63d5236ec7ba72ef04ad3f847b092feecb
33 DIST twisted-regen-cache.gz 911 BLAKE2B ffd3fcda6c67ffe6fd3ef581c8d507548396b66ed0708e9a5c790095e579c0d5f0f71596acf05712989da2ddef2b8d437eca973bc4d80ef8a9fa852915f38305 SHA512 95a9b931c73017d16d1b5e6b41345dddffe62b6af1a8e93b5e40d06d3d15be17b0dd0181c767ffeeb791534d463764ef9e066fa6c2ee2ac4b53c86d1da8fce03
34
35 diff --git a/dev-python/twisted/files/twisted-19.10.0-py38-cgi.patch b/dev-python/twisted/files/twisted-19.10.0-py38-cgi.patch
36 deleted file mode 100644
37 index 5fc4768e5d2..00000000000
38 --- a/dev-python/twisted/files/twisted-19.10.0-py38-cgi.patch
39 +++ /dev/null
40 @@ -1,41 +0,0 @@
41 -diff --git a/src/twisted/web/test/test_http.py b/src/twisted/web/test/test_http.py
42 -index 6001d1e40..1cf9172ef 100644
43 ---- a/src/twisted/web/test/test_http.py
44 -+++ b/src/twisted/web/test/test_http.py
45 -@@ -9,15 +9,15 @@ from __future__ import absolute_import, division
46 -
47 - import base64
48 - import calendar
49 --import cgi
50 - import random
51 -
52 - import hamcrest
53 -
54 - try:
55 - from urlparse import urlparse, urlunsplit, clear_cache
56 -+ from cgi import parse_qs
57 - except ImportError:
58 -- from urllib.parse import urlparse, urlunsplit, clear_cache
59 -+ from urllib.parse import urlparse, urlunsplit, clear_cache, parse_qs
60 -
61 - from io import BytesIO
62 - from itertools import cycle
63 -@@ -2156,15 +2156,15 @@ Hello,
64 - class QueryArgumentsTests(unittest.TestCase):
65 - def testParseqs(self):
66 - self.assertEqual(
67 -- cgi.parse_qs(b"a=b&d=c;+=f"),
68 -+ parse_qs(b"a=b&d=c;+=f"),
69 - http.parse_qs(b"a=b&d=c;+=f"))
70 - self.assertRaises(
71 - ValueError, http.parse_qs, b"blah", strict_parsing=True)
72 - self.assertEqual(
73 -- cgi.parse_qs(b"a=&b=c", keep_blank_values=1),
74 -+ parse_qs(b"a=&b=c", keep_blank_values=1),
75 - http.parse_qs(b"a=&b=c", keep_blank_values=1))
76 - self.assertEqual(
77 -- cgi.parse_qs(b"a=&b=c"),
78 -+ parse_qs(b"a=&b=c"),
79 - http.parse_qs(b"a=&b=c"))
80 -
81 -
82
83 diff --git a/dev-python/twisted/files/twisted-19.10.0-py38.patch b/dev-python/twisted/files/twisted-19.10.0-py38.patch
84 deleted file mode 100644
85 index e787167d45b..00000000000
86 --- a/dev-python/twisted/files/twisted-19.10.0-py38.patch
87 +++ /dev/null
88 @@ -1,110 +0,0 @@
89 -From d33b90880b8eb024daa73bc3fd39aca0bc791ff1 Mon Sep 17 00:00:00 2001
90 -From: =?UTF-8?q?Lucas=20Treffenst=C3=A4dt?= <lucas@×××××××××××××.de>
91 -Date: Mon, 13 Jan 2020 13:54:08 +0100
92 -Subject: [PATCH 1/2] CramMD5ClientAuthenticator now specifies the digestmod
93 - argument to hmac.HMAC constructor explicitly.
94 -
95 ----
96 - src/twisted/mail/_cred.py | 3 ++-
97 - 1 file changed, 2 insertions(+), 1 deletion(-)
98 -
99 -diff --git a/src/twisted/mail/_cred.py b/src/twisted/mail/_cred.py
100 -index 9d3646948..43c406f90 100644
101 ---- a/src/twisted/mail/_cred.py
102 -+++ b/src/twisted/mail/_cred.py
103 -@@ -8,6 +8,7 @@ Credential managers for L{twisted.mail}.
104 - from __future__ import absolute_import, division
105 -
106 - import hmac
107 -+import hashlib
108 -
109 - from zope.interface import implementer
110 -
111 -@@ -28,7 +29,7 @@ class CramMD5ClientAuthenticator:
112 -
113 -
114 - def challengeResponse(self, secret, chal):
115 -- response = hmac.HMAC(secret, chal).hexdigest().encode('ascii')
116 -+ response = hmac.HMAC(secret, chal, digestmod = hashlib.md5).hexdigest().encode('ascii')
117 - return self.user + b' ' + response
118 -
119 -
120 ---
121 -2.26.2
122 -
123 -From 694bc67f3cf7d36a6f512f0b76882e85d0966dd2 Mon Sep 17 00:00:00 2001
124 -From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Poisson?= <goffi@×××××.org>
125 -Date: Sun, 17 Nov 2019 19:48:53 +0100
126 -Subject: [PATCH 2/2] Fix parsing of namespaced attributes with Python 3.8 in
127 - twisted.words.xish.domish.ExpatElementStream
128 -
129 ----
130 - src/twisted/words/newsfragments/9730.bugfix | 1 +
131 - src/twisted/words/test/test_domish.py | 17 +++++++++++++++++
132 - src/twisted/words/xish/domish.py | 11 +++++++++--
133 - 3 files changed, 27 insertions(+), 2 deletions(-)
134 - create mode 100644 src/twisted/words/newsfragments/9730.bugfix
135 -
136 -diff --git a/src/twisted/words/newsfragments/9730.bugfix b/src/twisted/words/newsfragments/9730.bugfix
137 -new file mode 100644
138 -index 000000000..5c91305c8
139 ---- /dev/null
140 -+++ b/src/twisted/words/newsfragments/9730.bugfix
141 -@@ -0,0 +1 @@
142 -+Fixed parsing of streams with Python 3.8 when there are spaces in namespaces or namespaced attributes in twisted.words.xish.domish.ExpatElementStream
143 -diff --git a/src/twisted/words/test/test_domish.py b/src/twisted/words/test/test_domish.py
144 -index a8f8fa76b..cd16e3a4d 100644
145 ---- a/src/twisted/words/test/test_domish.py
146 -+++ b/src/twisted/words/test/test_domish.py
147 -@@ -350,6 +350,23 @@ class DomishStreamTestsMixin:
148 - self.elements[0].attributes, {(" bar baz ", "baz"): "quux"})
149 -
150 -
151 -+ def test_attributesWithNamespaces(self):
152 -+ """
153 -+ Attributes with namespace are parsed without Exception.
154 -+ (https://twistedmatrix.com/trac/ticket/9730 regression test)
155 -+ """
156 -+
157 -+ xml = b"""<root xmlns:test='http://example.org' xml:lang='en'>
158 -+ <test:test>test</test:test>
159 -+ </root>"""
160 -+
161 -+ # with Python 3.8 and without #9730 fix, the following error would
162 -+ # happen at next line:
163 -+ # ``RuntimeError: dictionary keys changed during iteration``
164 -+ self.stream.parse(xml)
165 -+ self.assertEqual(self.elements[0].uri, "http://example.org")
166 -+
167 -+
168 - def testChildPrefix(self):
169 - xml = b"<root xmlns='testns' xmlns:foo='testns2'><foo:child/></root>"
170 -
171 -diff --git a/src/twisted/words/xish/domish.py b/src/twisted/words/xish/domish.py
172 -index 2063c410a..fc49285f5 100644
173 ---- a/src/twisted/words/xish/domish.py
174 -+++ b/src/twisted/words/xish/domish.py
175 -@@ -807,11 +807,18 @@ class ExpatElementStream:
176 - qname = ('', name)
177 -
178 - # Process attributes
179 -+ newAttrs = {}
180 -+ toDelete = []
181 - for k, v in attrs.items():
182 - if " " in k:
183 - aqname = k.rsplit(" ", 1)
184 -- attrs[(aqname[0], aqname[1])] = v
185 -- del attrs[k]
186 -+ newAttrs[(aqname[0], aqname[1])] = v
187 -+ toDelete.append(k)
188 -+
189 -+ attrs.update(newAttrs)
190 -+
191 -+ for k in toDelete:
192 -+ del attrs[k]
193 -
194 - # Construct the new element
195 - e = Element(qname, self.defaultNsStack[-1], attrs, self.localPrefixes)
196 ---
197 -2.26.2
198 -
199
200 diff --git a/dev-python/twisted/files/twisted-19.10.0-py39-b64.patch b/dev-python/twisted/files/twisted-19.10.0-py39-b64.patch
201 deleted file mode 100644
202 index f67d6240558..00000000000
203 --- a/dev-python/twisted/files/twisted-19.10.0-py39-b64.patch
204 +++ /dev/null
205 @@ -1,165 +0,0 @@
206 -From f56133a2e0d7ddf9ee6e43bf9e1d62e970cb0b3a Mon Sep 17 00:00:00 2001
207 -From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
208 -Date: Wed, 27 May 2020 13:23:37 +0200
209 -Subject: [PATCH] Replace base64.*string() functions to fix py3.9 support
210 -
211 -Replace base64.decodestring() and .encodestring() functions as they
212 -were deprecated since Python 3.1 in favor of (equivalent) .decodebytes()
213 -and .encodebytes(), and were eventually removed in Python 3.9.
214 -
215 -While at it, replace most of their uses with base64.b64encode()
216 -and .b64decode() that are preferable to the former wrt ticket #6446,
217 -and they do not introduce line breaks that the twisted code usually
218 -discarded.
219 -
220 -Use .decodebytes() and .encodebytes() in DirDBM as it seems to rely
221 -on the exact presence of newlines, and changing that would break
222 -backwards compatibility.
223 -
224 -Fixes: ticket:6446
225 -Fixes: ticket:9831
226 ----
227 - src/twisted/conch/scripts/tkconch.py | 2 +-
228 - src/twisted/conch/test/test_keys.py | 2 +-
229 - src/twisted/mail/pop3.py | 4 ++--
230 - src/twisted/mail/test/test_pop3.py | 4 ++--
231 - src/twisted/persisted/dirdbm.py | 10 ++++++++--
232 - src/twisted/web/http.py | 2 +-
233 - src/twisted/web/test/test_http.py | 6 +++---
234 - 14 files changed, 18 insertions(+), 12 deletions(-)
235 -
236 -diff --git a/src/twisted/conch/scripts/tkconch.py b/src/twisted/conch/scripts/tkconch.py
237 -index 9c48e8a7f..5e007ebdc 100644
238 ---- a/src/twisted/conch/scripts/tkconch.py
239 -+++ b/src/twisted/conch/scripts/tkconch.py
240 -@@ -409,7 +409,7 @@ class SSHClientTransport(transport.SSHClientTransport):
241 - "known hosts.\r\n" %
242 - (khHost, {b'ssh-dss':'DSA', b'ssh-rsa':'RSA'}[keyType]))
243 - with open(os.path.expanduser('~/.ssh/known_hosts'), 'a') as known_hosts:
244 -- encodedKey = base64.encodestring(pubKey).replace(b'\n', b'')
245 -+ encodedKey = base64.b64encode(pubKey)
246 - known_hosts.write('\n%s %s %s' % (khHost, keyType, encodedKey))
247 - except:
248 - log.deferr()
249 -diff --git a/src/twisted/conch/test/test_keys.py b/src/twisted/conch/test/test_keys.py
250 -index 41e49f415..795e7b8d7 100644
251 ---- a/src/twisted/conch/test/test_keys.py
252 -+++ b/src/twisted/conch/test/test_keys.py
253 -@@ -352,7 +352,7 @@ SUrCyZXsNh6VXwjs3gKQ
254 -
255 - self.assertRaises(
256 - keys.BadKeyError,
257 -- keys.Key.fromString, data=b'{' + base64.encodestring(sexp) + b'}',
258 -+ keys.Key.fromString, data=b'{' + base64.b64encode(sexp) + b'}',
259 - )
260 -
261 -
262 -diff --git a/src/twisted/mail/pop3.py b/src/twisted/mail/pop3.py
263 -index ffe9714c9..057389e3a 100644
264 ---- a/src/twisted/mail/pop3.py
265 -+++ b/src/twisted/mail/pop3.py
266 -@@ -728,7 +728,7 @@ class POP3(basic.LineOnlyReceiver, policies.TimeoutMixin):
267 - self._auth = auth()
268 - chal = self._auth.getChallenge()
269 -
270 -- self.sendLine(b'+ ' + base64.encodestring(chal).rstrip(b'\n'))
271 -+ self.sendLine(b'+ ' + base64.b64encode(chal))
272 - self.state = 'AUTH'
273 -
274 -
275 -@@ -747,7 +747,7 @@ class POP3(basic.LineOnlyReceiver, policies.TimeoutMixin):
276 - """
277 - self.state = "COMMAND"
278 - try:
279 -- parts = base64.decodestring(line).split(None, 1)
280 -+ parts = base64.b64decode(line).split(None, 1)
281 - except binascii.Error:
282 - self.failResponse(b"Invalid BASE64 encoding")
283 - else:
284 -diff --git a/src/twisted/mail/test/test_pop3.py b/src/twisted/mail/test/test_pop3.py
285 -index ea513487c..36780d9c9 100644
286 ---- a/src/twisted/mail/test/test_pop3.py
287 -+++ b/src/twisted/mail/test/test_pop3.py
288 -@@ -1097,12 +1097,12 @@ class SASLTests(unittest.TestCase):
289 -
290 - p.lineReceived(b"AUTH CRAM-MD5")
291 - chal = s.getvalue().splitlines()[-1][2:]
292 -- chal = base64.decodestring(chal)
293 -+ chal = base64.b64decode(chal)
294 - response = hmac.HMAC(b'testpassword', chal,
295 - digestmod=md5).hexdigest().encode("ascii")
296 -
297 - p.lineReceived(
298 -- base64.encodestring(b'testuser ' + response).rstrip(b'\n'))
299 -+ base64.b64encode(b'testuser ' + response))
300 - self.assertTrue(p.mbox)
301 - self.assertTrue(s.getvalue().splitlines()[-1].find(b"+OK") >= 0)
302 - p.connectionLost(failure.Failure(Exception("Test harness disconnect")))
303 -diff --git a/src/twisted/persisted/dirdbm.py b/src/twisted/persisted/dirdbm.py
304 -index f97c526d0..d9f29cce2 100644
305 ---- a/src/twisted/persisted/dirdbm.py
306 -+++ b/src/twisted/persisted/dirdbm.py
307 -@@ -81,14 +81,20 @@ class DirDBM:
308 - Encode a key so it can be used as a filename.
309 - """
310 - # NOTE: '_' is NOT in the base64 alphabet!
311 -- return base64.encodestring(k).replace(b'\n', b'_').replace(b"/", b"-")
312 -+ try:
313 -+ return base64.encodebytes(k).replace(b'\n', b'_').replace(b"/", b"-")
314 -+ except AttributeError:
315 -+ return base64.encodestring(k).replace(b'\n', b'_').replace(b"/", b"-")
316 -
317 -
318 - def _decode(self, k):
319 - """
320 - Decode a filename to get the key.
321 - """
322 -- return base64.decodestring(k.replace(b'_', b'\n').replace(b"-", b"/"))
323 -+ try:
324 -+ return base64.decodebytes(k.replace(b'_', b'\n').replace(b"-", b"/"))
325 -+ except AttributeError:
326 -+ return base64.decodestring(k.replace(b'_', b'\n').replace(b"-", b"/"))
327 -
328 -
329 - def _readFile(self, path):
330 -diff --git a/src/twisted/web/http.py b/src/twisted/web/http.py
331 -index fe88d3373..602a58f31 100644
332 ---- a/src/twisted/web/http.py
333 -+++ b/src/twisted/web/http.py
334 -@@ -1540,7 +1540,7 @@ class Request:
335 - bas, upw = authh.split()
336 - if bas.lower() != b"basic":
337 - raise ValueError()
338 -- upw = base64.decodestring(upw)
339 -+ upw = base64.b64decode(upw)
340 - self.user, self.password = upw.split(b':', 1)
341 - except (binascii.Error, ValueError):
342 - self.user = self.password = ""
343 -diff --git a/src/twisted/web/test/test_http.py b/src/twisted/web/test/test_http.py
344 -index 6001d1e40..70065e232 100644
345 ---- a/src/twisted/web/test/test_http.py
346 -+++ b/src/twisted/web/test/test_http.py
347 -@@ -1513,7 +1513,7 @@ class ParsingTests(unittest.TestCase):
348 - requests.append(self)
349 -
350 - for u, p in [(b"foo", b"bar"), (b"hello", b"there:z")]:
351 -- s = base64.encodestring(b":".join((u, p))).strip()
352 -+ s = base64.b64encode(b":".join((u, p)))
353 - f = b"GET / HTTP/1.0\nAuthorization: Basic " + s + b"\n\n"
354 - self.runRequest(f, Request, 0)
355 - req = requests.pop()
356 -@@ -2139,9 +2139,9 @@ Hello,
357 -
358 - u = b"foo"
359 - p = b"bar"
360 -- s = base64.encodestring(b":".join((u, p))).strip()
361 -+ s = base64.b64encode(b":".join((u, p)))
362 - f = b"GET / HTTP/1.0\nAuthorization: Basic " + s + b"\n\n"
363 -- self.patch(base64, 'decodestring', lambda x: [])
364 -+ self.patch(base64, 'b64decode', lambda x: [])
365 - self.runRequest(f, Request, 0)
366 - req = requests.pop()
367 - self.assertEqual(('', ''), req.credentials)
368 ---
369 -2.26.2
370 -
371
372 diff --git a/dev-python/twisted/files/twisted-20.3.0-py38-cgi.patch b/dev-python/twisted/files/twisted-20.3.0-py38-cgi.patch
373 deleted file mode 100644
374 index 5151f297f7f..00000000000
375 --- a/dev-python/twisted/files/twisted-20.3.0-py38-cgi.patch
376 +++ /dev/null
377 @@ -1,259 +0,0 @@
378 -From 62ab0203c59c1f9788c53dfad4a212774094d05c Mon Sep 17 00:00:00 2001
379 -From: Craig Rodrigues <rodrigc@×××××××.org>
380 -Date: Mon, 13 Apr 2020 01:22:23 -0700
381 -Subject: [PATCH 2/2] Merge 9801-rodrigc-cgi: Change import of cgi.parse_qs to
382 - urllib.parse.parse_qs
383 -
384 -Author: rodrigc
385 -Reviewer: hawkowl
386 -Fixes: ticket:9801
387 ----
388 - src/twisted/web/client.py | 17 ++++-----
389 - src/twisted/web/http.py | 49 ++++++++++++-------------
390 - src/twisted/web/newsfragments/9801.misc | 0
391 - src/twisted/web/test/test_http.py | 41 +++------------------
392 - src/twisted/web/test/test_webclient.py | 5 +--
393 - 5 files changed, 38 insertions(+), 74 deletions(-)
394 - create mode 100644 src/twisted/web/newsfragments/9801.misc
395 -
396 -diff --git a/src/twisted/web/client.py b/src/twisted/web/client.py
397 -index 7e4642ef3..8209f5a5e 100644
398 ---- a/src/twisted/web/client.py
399 -+++ b/src/twisted/web/client.py
400 -@@ -12,15 +12,8 @@ import os
401 - import collections
402 - import warnings
403 -
404 --try:
405 -- from urlparse import urlunparse, urljoin, urldefrag
406 --except ImportError:
407 -- from urllib.parse import urljoin, urldefrag
408 -- from urllib.parse import urlunparse as _urlunparse
409 --
410 -- def urlunparse(parts):
411 -- result = _urlunparse(tuple([p.decode("charmap") for p in parts]))
412 -- return result.encode("charmap")
413 -+from urllib.parse import urljoin, urldefrag
414 -+from urllib.parse import urlunparse as _urlunparse
415 -
416 - import zlib
417 - from functools import wraps
418 -@@ -51,6 +44,12 @@ from twisted.web._newclient import _ensureValidURI, _ensureValidMethod
419 -
420 -
421 -
422 -+def urlunparse(parts):
423 -+ result = _urlunparse(tuple([p.decode("charmap") for p in parts]))
424 -+ return result.encode("charmap")
425 -+
426 -+
427 -+
428 - class PartialDownloadError(error.Error):
429 - """
430 - Page was only partially downloaded, we got disconnected in middle.
431 -diff --git a/src/twisted/web/http.py b/src/twisted/web/http.py
432 -index b7afa8b0d..94d0ae81f 100644
433 ---- a/src/twisted/web/http.py
434 -+++ b/src/twisted/web/http.py
435 -@@ -66,27 +66,10 @@ import time
436 - import calendar
437 - import warnings
438 - import os
439 --from io import BytesIO as StringIO
440 --
441 --try:
442 -- from urlparse import (
443 -- ParseResult as ParseResultBytes, urlparse as _urlparse)
444 -- from urllib import unquote
445 -- from cgi import parse_header as _parseHeader
446 --except ImportError:
447 -- from urllib.parse import (
448 -- ParseResultBytes, urlparse as _urlparse, unquote_to_bytes as unquote)
449 --
450 -- def _parseHeader(line):
451 -- # cgi.parse_header requires a str
452 -- key, pdict = cgi.parse_header(line.decode('charmap'))
453 --
454 -- # We want the key as bytes, and cgi.parse_multipart (which consumes
455 -- # pdict) expects a dict of str keys but bytes values
456 -- key = key.encode('charmap')
457 -- pdict = {x:y.encode('charmap') for x, y in pdict.items()}
458 -- return (key, pdict)
459 -+from io import BytesIO
460 -
461 -+from urllib.parse import (
462 -+ ParseResultBytes, urlparse as _urlparse, unquote_to_bytes as unquote)
463 -
464 - from zope.interface import Attribute, Interface, implementer, provider
465 -
466 -@@ -163,6 +146,20 @@ monthname = [None,
467 - weekdayname_lower = [name.lower() for name in weekdayname]
468 - monthname_lower = [name and name.lower() for name in monthname]
469 -
470 -+
471 -+
472 -+def _parseHeader(line):
473 -+ # cgi.parse_header requires a str
474 -+ key, pdict = cgi.parse_header(line.decode('charmap'))
475 -+
476 -+ # We want the key as bytes, and cgi.parse_multipart (which consumes
477 -+ # pdict) expects a dict of str keys but bytes values
478 -+ key = key.encode('charmap')
479 -+ pdict = {x: y.encode('charmap') for x, y in pdict.items()}
480 -+ return (key, pdict)
481 -+
482 -+
483 -+
484 - def urlparse(url):
485 - """
486 - Parse an URL into six components.
487 -@@ -486,13 +483,15 @@ class _IDeprecatedHTTPChannelToRequestInterface(Interface):
488 -
489 - class StringTransport:
490 - """
491 -- I am a StringIO wrapper that conforms for the transport API. I support
492 -+ I am a BytesIO wrapper that conforms for the transport API. I support
493 - the `writeSequence' method.
494 - """
495 - def __init__(self):
496 -- self.s = StringIO()
497 -+ self.s = BytesIO()
498 -+
499 - def writeSequence(self, seq):
500 - self.s.write(b''.join(seq))
501 -+
502 - def __getattr__(self, attr):
503 - return getattr(self.__dict__['s'], attr)
504 -
505 -@@ -513,7 +512,7 @@ class HTTPClient(basic.LineReceiver):
506 - @type firstLine: C{bool}
507 -
508 - @ivar __buffer: The buffer that stores the response to the HTTP request.
509 -- @type __buffer: A C{StringIO} object.
510 -+ @type __buffer: A C{BytesIO} object.
511 -
512 - @ivar _header: Part or all of an HTTP request header.
513 - @type _header: C{bytes}
514 -@@ -579,7 +578,7 @@ class HTTPClient(basic.LineReceiver):
515 - if self._header != b"":
516 - # Only extract headers if there are any
517 - self.extractHeader(self._header)
518 -- self.__buffer = StringIO()
519 -+ self.__buffer = BytesIO()
520 - self.handleEndHeaders()
521 - self.setRawMode()
522 - return
523 -@@ -665,7 +664,7 @@ def _getContentFile(length):
524 - Get a writeable file-like object to which request content can be written.
525 - """
526 - if length is not None and length < 100000:
527 -- return StringIO()
528 -+ return BytesIO()
529 - return tempfile.TemporaryFile()
530 -
531 -
532 -diff --git a/src/twisted/web/newsfragments/9801.misc b/src/twisted/web/newsfragments/9801.misc
533 -new file mode 100644
534 -index 000000000..e69de29bb
535 -diff --git a/src/twisted/web/test/test_http.py b/src/twisted/web/test/test_http.py
536 -index a3067f732..4189b307c 100644
537 ---- a/src/twisted/web/test/test_http.py
538 -+++ b/src/twisted/web/test/test_http.py
539 -@@ -9,15 +9,11 @@ from __future__ import absolute_import, division
540 -
541 - import base64
542 - import calendar
543 --import cgi
544 - import random
545 -
546 - import hamcrest
547 -
548 --try:
549 -- from urlparse import urlparse, urlunsplit, clear_cache
550 --except ImportError:
551 -- from urllib.parse import urlparse, urlunsplit, clear_cache
552 -+from urllib.parse import urlparse, urlunsplit, clear_cache, parse_qs
553 -
554 - from io import BytesIO
555 - from itertools import cycle
556 -@@ -28,7 +24,7 @@ from zope.interface import (
557 - )
558 - from zope.interface.verify import verifyObject
559 -
560 --from twisted.python.compat import (_PY3, iterbytes, long, networkString,
561 -+from twisted.python.compat import (iterbytes, long, networkString,
562 - unicode, intToBytes)
563 - from twisted.python.components import proxyForInterface
564 - from twisted.python.failure import Failure
565 -@@ -2019,33 +2015,6 @@ Content-Type: application/x-www-form-urlencoded
566 - self.assertEqual(content, [networkString(query)])
567 -
568 -
569 -- def test_missingContentDisposition(self):
570 -- """
571 -- If the C{Content-Disposition} header is missing, the request is denied
572 -- as a bad request.
573 -- """
574 -- req = b'''\
575 --POST / HTTP/1.0
576 --Content-Type: multipart/form-data; boundary=AaB03x
577 --Content-Length: 103
578 --
579 ----AaB03x
580 --Content-Type: text/plain
581 --Content-Transfer-Encoding: quoted-printable
582 --
583 --abasdfg
584 ----AaB03x--
585 --'''
586 -- channel = self.runRequest(req, http.Request, success=False)
587 -- self.assertEqual(
588 -- channel.transport.value(),
589 -- b"HTTP/1.1 400 Bad Request\r\n\r\n")
590 --
591 -- if _PY3:
592 -- test_missingContentDisposition.skip = (
593 -- "cgi.parse_multipart is much more error-tolerant on Python 3.")
594 --
595 --
596 - def test_multipartProcessingFailure(self):
597 - """
598 - When the multipart processing fails the client gets a 400 Bad Request.
599 -@@ -2373,15 +2342,15 @@ ok
600 - class QueryArgumentsTests(unittest.TestCase):
601 - def testParseqs(self):
602 - self.assertEqual(
603 -- cgi.parse_qs(b"a=b&d=c;+=f"),
604 -+ parse_qs(b"a=b&d=c;+=f"),
605 - http.parse_qs(b"a=b&d=c;+=f"))
606 - self.assertRaises(
607 - ValueError, http.parse_qs, b"blah", strict_parsing=True)
608 - self.assertEqual(
609 -- cgi.parse_qs(b"a=&b=c", keep_blank_values=1),
610 -+ parse_qs(b"a=&b=c", keep_blank_values=1),
611 - http.parse_qs(b"a=&b=c", keep_blank_values=1))
612 - self.assertEqual(
613 -- cgi.parse_qs(b"a=&b=c"),
614 -+ parse_qs(b"a=&b=c"),
615 - http.parse_qs(b"a=&b=c"))
616 -
617 -
618 -diff --git a/src/twisted/web/test/test_webclient.py b/src/twisted/web/test/test_webclient.py
619 -index 680e02780..672594993 100644
620 ---- a/src/twisted/web/test/test_webclient.py
621 -+++ b/src/twisted/web/test/test_webclient.py
622 -@@ -11,10 +11,7 @@ import io
623 - import os
624 - from errno import ENOSPC
625 -
626 --try:
627 -- from urlparse import urlparse, urljoin
628 --except ImportError:
629 -- from urllib.parse import urlparse, urljoin
630 -+from urllib.parse import urlparse, urljoin
631 -
632 - from twisted.python.compat import networkString, nativeString, intToBytes
633 - from twisted.trial import unittest, util
634 ---
635 -2.26.2
636 -
637
638 diff --git a/dev-python/twisted/files/twisted-20.3.0-py38-hmac.patch b/dev-python/twisted/files/twisted-20.3.0-py38-hmac.patch
639 deleted file mode 100644
640 index 1c1ee01b218..00000000000
641 --- a/dev-python/twisted/files/twisted-20.3.0-py38-hmac.patch
642 +++ /dev/null
643 @@ -1,94 +0,0 @@
644 -From 653fb2aea0ca1f60558917d52f4ff0c33cd7b067 Mon Sep 17 00:00:00 2001
645 -From: Craig Rodrigues <rodrigc@××××××××××.org>
646 -Date: Sun, 12 Apr 2020 14:28:23 -0700
647 -Subject: [PATCH 1/2] Add digestmod parameter to HMAC.__init__() invocations
648 -
649 -This parameter is now required on Python 3.8+
650 ----
651 - src/twisted/cred/credentials.py | 3 ++-
652 - src/twisted/cred/test/test_cramauth.py | 11 ++++++++---
653 - src/twisted/mail/test/test_pop3.py | 4 +++-
654 - 3 files changed, 13 insertions(+), 5 deletions(-)
655 -
656 -diff --git a/src/twisted/cred/credentials.py b/src/twisted/cred/credentials.py
657 -index 5469e5158..67c24cb01 100644
658 ---- a/src/twisted/cred/credentials.py
659 -+++ b/src/twisted/cred/credentials.py
660 -@@ -441,7 +441,8 @@ class CramMD5Credentials(object):
661 -
662 -
663 - def checkPassword(self, password):
664 -- verify = hexlify(hmac.HMAC(password, self.challenge).digest())
665 -+ verify = hexlify(hmac.HMAC(password, self.challenge,
666 -+ digestmod=md5).digest())
667 - return verify == self.response
668 -
669 -
670 -diff --git a/src/twisted/cred/test/test_cramauth.py b/src/twisted/cred/test/test_cramauth.py
671 -index 1ee08712b..d21f2f68c 100644
672 ---- a/src/twisted/cred/test/test_cramauth.py
673 -+++ b/src/twisted/cred/test/test_cramauth.py
674 -@@ -7,6 +7,8 @@ Tests for L{twisted.cred}'s implementation of CRAM-MD5.
675 -
676 - from __future__ import division, absolute_import
677 -
678 -+import hashlib
679 -+
680 - from hmac import HMAC
681 - from binascii import hexlify
682 -
683 -@@ -39,7 +41,8 @@ class CramMD5CredentialsTests(TestCase):
684 - """
685 - c = CramMD5Credentials()
686 - chal = c.getChallenge()
687 -- c.response = hexlify(HMAC(b'secret', chal).digest())
688 -+ c.response = hexlify(HMAC(b'secret', chal,
689 -+ digestmod=hashlib.md5).digest())
690 - self.assertTrue(c.checkPassword(b'secret'))
691 -
692 -
693 -@@ -61,7 +64,8 @@ class CramMD5CredentialsTests(TestCase):
694 - """
695 - c = CramMD5Credentials()
696 - chal = c.getChallenge()
697 -- c.response = hexlify(HMAC(b'thewrongsecret', chal).digest())
698 -+ c.response = hexlify(HMAC(b'thewrongsecret', chal,
699 -+ digestmod=hashlib.md5).digest())
700 - self.assertFalse(c.checkPassword(b'secret'))
701 -
702 -
703 -@@ -75,7 +79,8 @@ class CramMD5CredentialsTests(TestCase):
704 - chal = c.getChallenge()
705 - c.setResponse(b" ".join(
706 - (b"squirrel",
707 -- hexlify(HMAC(b'supersecret', chal).digest()))))
708 -+ hexlify(HMAC(b'supersecret', chal,
709 -+ digestmod=hashlib.md5).digest()))))
710 - self.assertTrue(c.checkPassword(b'supersecret'))
711 - self.assertEqual(c.username, b"squirrel")
712 -
713 -diff --git a/src/twisted/mail/test/test_pop3.py b/src/twisted/mail/test/test_pop3.py
714 -index 4a59c3b49..ea513487c 100644
715 ---- a/src/twisted/mail/test/test_pop3.py
716 -+++ b/src/twisted/mail/test/test_pop3.py
717 -@@ -11,6 +11,7 @@ import hmac
718 - import base64
719 - import itertools
720 -
721 -+from hashlib import md5
722 - from collections import OrderedDict
723 - from io import BytesIO
724 -
725 -@@ -1097,7 +1098,8 @@ class SASLTests(unittest.TestCase):
726 - p.lineReceived(b"AUTH CRAM-MD5")
727 - chal = s.getvalue().splitlines()[-1][2:]
728 - chal = base64.decodestring(chal)
729 -- response = hmac.HMAC(b'testpassword', chal).hexdigest().encode("ascii")
730 -+ response = hmac.HMAC(b'testpassword', chal,
731 -+ digestmod=md5).hexdigest().encode("ascii")
732 -
733 - p.lineReceived(
734 - base64.encodestring(b'testuser ' + response).rstrip(b'\n'))
735 ---
736 -2.26.2
737 -
738
739 diff --git a/dev-python/twisted/files/twisted-20.3.0-py39-b64.patch b/dev-python/twisted/files/twisted-20.3.0-py39-b64.patch
740 deleted file mode 100644
741 index f475614df40..00000000000
742 --- a/dev-python/twisted/files/twisted-20.3.0-py39-b64.patch
743 +++ /dev/null
744 @@ -1,158 +0,0 @@
745 -From f44c2ff111a8961d295409186cc07aaf414c76bc Mon Sep 17 00:00:00 2001
746 -From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
747 -Date: Wed, 27 May 2020 13:23:37 +0200
748 -Subject: [PATCH 1/4] Replace base64.*string() functions to fix py3.9 support
749 -
750 -Replace base64.decodestring() and .encodestring() functions as they
751 -were deprecated since Python 3.1 in favor of (equivalent) .decodebytes()
752 -and .encodebytes(), and were eventually removed in Python 3.9.
753 -
754 -While at it, replace most of their uses with base64.b64encode()
755 -and .b64decode() that are preferable to the former wrt ticket #6446,
756 -and they do not introduce line breaks that the twisted code usually
757 -discarded.
758 -
759 -Use .decodebytes() and .encodebytes() in DirDBM as it seems to rely
760 -on the exact presence of newlines, and changing that would break
761 -backwards compatibility.
762 -
763 -Fixes: ticket:6446
764 -Fixes: ticket:9831
765 ----
766 - src/twisted/conch/scripts/tkconch.py | 2 +-
767 - src/twisted/conch/test/test_keys.py | 2 +-
768 - src/twisted/mail/pop3.py | 4 ++--
769 - src/twisted/mail/test/test_pop3.py | 4 ++--
770 - src/twisted/persisted/dirdbm.py | 4 ++--
771 - src/twisted/web/http.py | 2 +-
772 - src/twisted/web/test/test_http.py | 6 +++---
773 - 14 files changed, 12 insertions(+), 12 deletions(-)
774 -
775 -diff --git a/src/twisted/conch/scripts/tkconch.py b/src/twisted/conch/scripts/tkconch.py
776 -index a662cabc8..744734343 100644
777 ---- a/src/twisted/conch/scripts/tkconch.py
778 -+++ b/src/twisted/conch/scripts/tkconch.py
779 -@@ -412,7 +412,7 @@ class SSHClientTransport(transport.SSHClientTransport):
780 - "known hosts.\r\n" %
781 - (khHost, {b'ssh-dss':'DSA', b'ssh-rsa':'RSA'}[keyType]))
782 - with open(os.path.expanduser('~/.ssh/known_hosts'), 'a') as known_hosts:
783 -- encodedKey = base64.encodestring(pubKey).replace(b'\n', b'')
784 -+ encodedKey = base64.b64encode(pubKey)
785 - known_hosts.write('\n%s %s %s' % (khHost, keyType, encodedKey))
786 - except:
787 - log.deferr()
788 -diff --git a/src/twisted/conch/test/test_keys.py b/src/twisted/conch/test/test_keys.py
789 -index 650a19bfb..f76cbd1b4 100644
790 ---- a/src/twisted/conch/test/test_keys.py
791 -+++ b/src/twisted/conch/test/test_keys.py
792 -@@ -404,7 +404,7 @@ SUrCyZXsNh6VXwjs3gKQ
793 -
794 - self.assertRaises(
795 - keys.BadKeyError,
796 -- keys.Key.fromString, data=b'{' + base64.encodestring(sexp) + b'}',
797 -+ keys.Key.fromString, data=b'{' + base64.b64encode(sexp) + b'}',
798 - )
799 -
800 -
801 -diff --git a/src/twisted/mail/pop3.py b/src/twisted/mail/pop3.py
802 -index ffe9714c9..057389e3a 100644
803 ---- a/src/twisted/mail/pop3.py
804 -+++ b/src/twisted/mail/pop3.py
805 -@@ -728,7 +728,7 @@ class POP3(basic.LineOnlyReceiver, policies.TimeoutMixin):
806 - self._auth = auth()
807 - chal = self._auth.getChallenge()
808 -
809 -- self.sendLine(b'+ ' + base64.encodestring(chal).rstrip(b'\n'))
810 -+ self.sendLine(b'+ ' + base64.b64encode(chal))
811 - self.state = 'AUTH'
812 -
813 -
814 -@@ -747,7 +747,7 @@ class POP3(basic.LineOnlyReceiver, policies.TimeoutMixin):
815 - """
816 - self.state = "COMMAND"
817 - try:
818 -- parts = base64.decodestring(line).split(None, 1)
819 -+ parts = base64.b64decode(line).split(None, 1)
820 - except binascii.Error:
821 - self.failResponse(b"Invalid BASE64 encoding")
822 - else:
823 -diff --git a/src/twisted/mail/test/test_pop3.py b/src/twisted/mail/test/test_pop3.py
824 -index f7fbfaf1e..af335ab2d 100644
825 ---- a/src/twisted/mail/test/test_pop3.py
826 -+++ b/src/twisted/mail/test/test_pop3.py
827 -@@ -1096,12 +1096,12 @@ class SASLTests(unittest.TestCase):
828 -
829 - p.lineReceived(b"AUTH CRAM-MD5")
830 - chal = s.getvalue().splitlines()[-1][2:]
831 -- chal = base64.decodestring(chal)
832 -+ chal = base64.b64decode(chal)
833 - response = hmac.HMAC(b'testpassword', chal,
834 - digestmod=md5).hexdigest().encode("ascii")
835 -
836 - p.lineReceived(
837 -- base64.encodestring(b'testuser ' + response).rstrip(b'\n'))
838 -+ base64.b64encode(b'testuser ' + response))
839 - self.assertTrue(p.mbox)
840 - self.assertTrue(s.getvalue().splitlines()[-1].find(b"+OK") >= 0)
841 - p.connectionLost(failure.Failure(Exception("Test harness disconnect")))
842 -diff --git a/src/twisted/persisted/dirdbm.py b/src/twisted/persisted/dirdbm.py
843 -index 3ba7a59d4..7659ff765 100644
844 ---- a/src/twisted/persisted/dirdbm.py
845 -+++ b/src/twisted/persisted/dirdbm.py
846 -@@ -77,14 +77,14 @@ class DirDBM:
847 - Encode a key so it can be used as a filename.
848 - """
849 - # NOTE: '_' is NOT in the base64 alphabet!
850 -- return base64.encodestring(k).replace(b'\n', b'_').replace(b"/", b"-")
851 -+ return base64.encodebytes(k).replace(b'\n', b'_').replace(b"/", b"-")
852 -
853 -
854 - def _decode(self, k):
855 - """
856 - Decode a filename to get the key.
857 - """
858 -- return base64.decodestring(k.replace(b'_', b'\n').replace(b"-", b"/"))
859 -+ return base64.decodebytes(k.replace(b'_', b'\n').replace(b"-", b"/"))
860 -
861 -
862 - def _readFile(self, path):
863 -diff --git a/src/twisted/web/http.py b/src/twisted/web/http.py
864 -index 0e115741e..e9a080d21 100644
865 ---- a/src/twisted/web/http.py
866 -+++ b/src/twisted/web/http.py
867 -@@ -1544,7 +1544,7 @@ class Request:
868 - bas, upw = authh.split()
869 - if bas.lower() != b"basic":
870 - raise ValueError()
871 -- upw = base64.decodestring(upw)
872 -+ upw = base64.b64decode(upw)
873 - self.user, self.password = upw.split(b':', 1)
874 - except (binascii.Error, ValueError):
875 - self.user = self.password = b''
876 -diff --git a/src/twisted/web/test/test_http.py b/src/twisted/web/test/test_http.py
877 -index 112e56f46..02a4674a7 100644
878 ---- a/src/twisted/web/test/test_http.py
879 -+++ b/src/twisted/web/test/test_http.py
880 -@@ -1604,7 +1604,7 @@ class ParsingTests(unittest.TestCase):
881 - requests.append(self)
882 -
883 - for u, p in [(b"foo", b"bar"), (b"hello", b"there:z")]:
884 -- s = base64.encodestring(b":".join((u, p))).strip()
885 -+ s = base64.b64encode(b":".join((u, p)))
886 - f = b"GET / HTTP/1.0\nAuthorization: Basic " + s + b"\n\n"
887 - self.runRequest(f, Request, 0)
888 - req = requests.pop()
889 -@@ -2209,9 +2209,9 @@ Hello,
890 -
891 - u = b"foo"
892 - p = b"bar"
893 -- s = base64.encodestring(b":".join((u, p))).strip()
894 -+ s = base64.b64encode(b":".join((u, p)))
895 - f = b"GET / HTTP/1.0\nAuthorization: Basic " + s + b"\n\n"
896 -- self.patch(base64, 'decodestring', lambda x: [])
897 -+ self.patch(base64, 'b64decode', lambda x: [])
898 - self.runRequest(f, Request, 0)
899 - req = requests.pop()
900 - self.assertEqual((b'', b''), req.credentials)
901 ---
902 -2.26.2
903
904 diff --git a/dev-python/twisted/files/twisted-20.3.0-py39-combined.patch b/dev-python/twisted/files/twisted-20.3.0-py39-combined.patch
905 deleted file mode 100644
906 index 0ed1f7b8d9c..00000000000
907 --- a/dev-python/twisted/files/twisted-20.3.0-py39-combined.patch
908 +++ /dev/null
909 @@ -1,115 +0,0 @@
910 -From 2d30860a8b71e90513ead9958f5dd312802b0d36 Mon Sep 17 00:00:00 2001
911 -From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
912 -Date: Wed, 27 May 2020 14:40:53 +0200
913 -Subject: [PATCH 2/4] Fix imap4-utf-7 codec lookup function for Python 3.9
914 -
915 -Python 3.9 normalizes the codec name into 'imap4_utf_7' rather than
916 -'imap4-utf-7', and therefore the lookup function needs to account
917 -for the former name. Transform the latter locally to preserve support
918 -for all Python versions.
919 -
920 -Fixes: ticket: 9832
921 ----
922 - src/twisted/mail/imap4.py | 2 +-
923 - 2 files changed, 1 insertion(+), 1 deletion(-)
924 -
925 -diff --git a/src/twisted/mail/imap4.py b/src/twisted/mail/imap4.py
926 -index 736ef111d..3f32982ca 100644
927 ---- a/src/twisted/mail/imap4.py
928 -+++ b/src/twisted/mail/imap4.py
929 -@@ -6369,7 +6369,7 @@ _codecInfo = codecs.CodecInfo(encoder, decoder, StreamReader, StreamWriter)
930 -
931 -
932 - def imap4_utf_7(name):
933 -- if name == 'imap4-utf-7':
934 -+ if name.replace('-', '_') == 'imap4_utf_7':
935 - return _codecInfo
936 -
937 - codecs.register(imap4_utf_7)
938 ---
939 -2.26.2
940 -
941 -From daf928bf0f0371816dddbd4929948c4213d0cdcb Mon Sep 17 00:00:00 2001
942 -From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
943 -Date: Wed, 27 May 2020 15:12:54 +0200
944 -Subject: [PATCH 3/4] Fix verifyCryptedPassword() for crypt.crypt() throwing in
945 - py3.9
946 -
947 -In Python 3.9, the crypt.crypt() function may throw an exception
948 -if the underlying crypt() function fails. Update
949 -verifyCryptedPassword() to account for that, and preserve the existing
950 -behavior of returning False in that case.
951 -
952 -Fixes: ticket:9833
953 ----
954 - src/twisted/conch/checkers.py | 5 ++++-
955 - src/twisted/plugins/cred_unix.py | 5 ++++-
956 - 4 files changed, 8 insertions(+), 2 deletions(-)
957 -
958 -diff --git a/src/twisted/conch/checkers.py b/src/twisted/conch/checkers.py
959 -index 917567a39..e4e327b16 100644
960 ---- a/src/twisted/conch/checkers.py
961 -+++ b/src/twisted/conch/checkers.py
962 -@@ -53,7 +53,10 @@ def verifyCryptedPassword(crypted, pw):
963 -
964 - @rtype: L{bool}
965 - """
966 -- return crypt.crypt(pw, crypted) == crypted
967 -+ try:
968 -+ return crypt.crypt(pw, crypted) == crypted
969 -+ except OSError:
970 -+ return False
971 -
972 -
973 -
974 -diff --git a/src/twisted/plugins/cred_unix.py b/src/twisted/plugins/cred_unix.py
975 -index 211b4ccbc..a662719b6 100644
976 ---- a/src/twisted/plugins/cred_unix.py
977 -+++ b/src/twisted/plugins/cred_unix.py
978 -@@ -43,7 +43,10 @@ def verifyCryptedPassword(crypted, pw):
979 - pw = pw.decode('utf-8')
980 - if not isinstance(crypted, StringType):
981 - crypted = crypted.decode('utf-8')
982 -- return crypt.crypt(pw, crypted) == crypted
983 -+ try:
984 -+ return crypt.crypt(pw, crypted) == crypted
985 -+ except OSError:
986 -+ return False
987 -
988 -
989 -
990 ---
991 -2.26.2
992 -
993 -From 4fc435df0d1eba3e5d6416a2b86d39d3404f82fe Mon Sep 17 00:00:00 2001
994 -From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
995 -Date: Wed, 27 May 2020 15:37:10 +0200
996 -Subject: [PATCH 4/4] Use xml.etree.ElementTree instead of deprecated
997 - cElementTree
998 -
999 -The xml.etree.cElementTree is deprecated, and has been removed in Python
1000 -3.9. At the same time, xml.etree.ElementTree has already been using
1001 -cElementTree implicitly since Python 3.3. Update test_flatten to use
1002 -the latter to provide compatibility with newer Python versions.
1003 -
1004 -Fixes: ticket:9834
1005 ----
1006 - src/twisted/web/test/test_flatten.py | 2 +-
1007 - 2 files changed, 1 insertion(+), 1 deletion(-)
1008 -
1009 -diff --git a/src/twisted/web/test/test_flatten.py b/src/twisted/web/test/test_flatten.py
1010 -index 677401c55..61d50e20a 100644
1011 ---- a/src/twisted/web/test/test_flatten.py
1012 -+++ b/src/twisted/web/test/test_flatten.py
1013 -@@ -9,7 +9,7 @@ L{twisted.web._flatten}.
1014 - import sys
1015 - import traceback
1016 -
1017 --from xml.etree.cElementTree import XML
1018 -+from xml.etree.ElementTree import XML
1019 -
1020 - from collections import OrderedDict
1021 -
1022 ---
1023 -2.26.2
1024 -
1025
1026 diff --git a/dev-python/twisted/twisted-19.10.0.ebuild b/dev-python/twisted/twisted-19.10.0.ebuild
1027 deleted file mode 100644
1028 index cd70c36f469..00000000000
1029 --- a/dev-python/twisted/twisted-19.10.0.ebuild
1030 +++ /dev/null
1031 @@ -1,194 +0,0 @@
1032 -# Copyright 1999-2021 Gentoo Authors
1033 -# Distributed under the terms of the GNU General Public License v2
1034 -
1035 -EAPI=7
1036 -
1037 -PYTHON_COMPAT=( python3_{7,8,9} )
1038 -PYTHON_REQ_USE="threads(+)"
1039 -
1040 -inherit distutils-r1 virtualx
1041 -
1042 -TWISTED_PN="Twisted"
1043 -TWISTED_P="${TWISTED_PN}-${PV}"
1044 -TWISTED_RELEASE=$(ver_cut 1-2)
1045 -
1046 -DESCRIPTION="An asynchronous networking framework written in Python"
1047 -HOMEPAGE="https://www.twistedmatrix.com/trac/"
1048 -SRC_URI="https://twistedmatrix.com/Releases/${TWISTED_PN}"
1049 -SRC_URI="${SRC_URI}/${TWISTED_RELEASE}/${TWISTED_P}.tar.bz2
1050 - https://dev.gentoo.org/~mgorny/dist/twisted-regen-cache.gz"
1051 -S=${WORKDIR}/${TWISTED_P}
1052 -
1053 -KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~s390 sparc x86 ~amd64-linux ~x86-linux"
1054 -
1055 -LICENSE="MIT"
1056 -SLOT="0"
1057 -IUSE="conch crypt http2 serial test"
1058 -RESTRICT="!test? ( test )"
1059 -
1060 -RDEPEND="
1061 - >=dev-python/attrs-17.4.0[${PYTHON_USEDEP}]
1062 - >=dev-python/automat-0.3.0[${PYTHON_USEDEP}]
1063 - >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}]
1064 - >=dev-python/hyperlink-17.1.1[${PYTHON_USEDEP}]
1065 - >=dev-python/incremental-16.10.1[${PYTHON_USEDEP}]
1066 - >=dev-python/pyhamcrest-1.9.0[${PYTHON_USEDEP}]
1067 - >=dev-python/zope-interface-4.4.2[${PYTHON_USEDEP}]
1068 - conch? (
1069 - dev-python/pyasn1[${PYTHON_USEDEP}]
1070 - >=dev-python/cryptography-1.5.0[${PYTHON_USEDEP}]
1071 - >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}]
1072 - )
1073 - crypt? (
1074 - >=dev-python/pyopenssl-16.0.0[${PYTHON_USEDEP}]
1075 - dev-python/service_identity[${PYTHON_USEDEP}]
1076 - >=dev-python/idna-0.6[${PYTHON_USEDEP}]
1077 - )
1078 - serial? ( >=dev-python/pyserial-3.0[${PYTHON_USEDEP}] )
1079 - http2? (
1080 - >=dev-python/hyper-h2-3.0.0[${PYTHON_USEDEP}]
1081 - <dev-python/hyper-h2-4.0.0[${PYTHON_USEDEP}]
1082 - >=dev-python/priority-1.1.0[${PYTHON_USEDEP}]
1083 - <dev-python/priority-2.0[${PYTHON_USEDEP}]
1084 - )
1085 - !dev-python/twisted-core
1086 - !dev-python/twisted-conch
1087 - !dev-python/twisted-lore
1088 - !dev-python/twisted-mail
1089 - !dev-python/twisted-names
1090 - !dev-python/twisted-news
1091 - !dev-python/twisted-pair
1092 - !dev-python/twisted-runner
1093 - !dev-python/twisted-words
1094 - !dev-python/twisted-web
1095 -"
1096 -DEPEND="
1097 - dev-python/bcrypt
1098 - >=dev-python/incremental-16.10.1[${PYTHON_USEDEP}]
1099 - test? (
1100 - dev-python/gmpy[${PYTHON_USEDEP}]
1101 - dev-python/pyasn1[${PYTHON_USEDEP}]
1102 - >=dev-python/cryptography-0.9.1[${PYTHON_USEDEP}]
1103 - >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}]
1104 - >=dev-python/pyopenssl-0.13[${PYTHON_USEDEP}]
1105 - dev-python/service_identity[${PYTHON_USEDEP}]
1106 - dev-python/idna[${PYTHON_USEDEP}]
1107 - dev-python/pyserial[${PYTHON_USEDEP}]
1108 - >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}]
1109 - net-misc/openssh
1110 - )
1111 -"
1112 -
1113 -python_prepare_all() {
1114 - local PATCHES=(
1115 - "${FILESDIR}"/${P}-py38.patch
1116 - "${FILESDIR}"/twisted-19.10.0-py38-cgi.patch
1117 - "${FILESDIR}"/twisted-20.3.0-py38-hmac.patch
1118 - "${FILESDIR}"/twisted-19.10.0-py39-b64.patch
1119 - "${FILESDIR}"/twisted-20.3.0-py39-combined.patch
1120 - )
1121 -
1122 - # upstream test for making releases; not very useful and requires
1123 - # sphinx (including on py2)
1124 - rm src/twisted/python/test/test_release.py || die
1125 -
1126 - # Conch doesn't work with latest >=OpenSSH 7.6
1127 - # - https://twistedmatrix.com/trac/ticket/9311
1128 - # - https://twistedmatrix.com/trac/ticket/9515
1129 - rm src/twisted/conch/test/test_ckeygen.py || die
1130 - rm src/twisted/conch/test/test_conch.py || die
1131 - rm src/twisted/conch/test/test_cftp.py || die
1132 -
1133 - # puts system in EMFILE state, then the exception handler may fail
1134 - # trying to open more files due to some gi magic
1135 - sed -e '/SKIP_EMFILE/s:None:"Fails on non-pristine systems":' \
1136 - -i src/twisted/internet/test/test_tcp.py || die
1137 -
1138 - # TODO: times out, i can't find where to increase the timeout
1139 - sed -e 's:test_manyProcesses:_&:' \
1140 - -i src/twisted/test/test_process.py || die
1141 -
1142 - # multicast tests fail within network-sandbox
1143 - sed -e 's:test_joinLeave:_&:' \
1144 - -e 's:test_loopback:_&:' \
1145 - -e 's:test_multiListen:_&:' \
1146 - -e 's:test_multicast:_&:' \
1147 - -i src/twisted/test/test_udp.py || die
1148 -
1149 - # accesses /dev/net/tun
1150 - sed -e '/class RealDeviceTestsMixin/a\
1151 - skip = "Requires extra permissions"' \
1152 - -i src/twisted/pair/test/test_tuntap.py || die
1153 -
1154 - # TODO: figure it out, probably doesn't accept DST date here
1155 - sed -e 's:test_getTimezoneOffsetWithoutDaylightSavingTime:_&:' \
1156 - -i src/twisted/test/test_log.py || die
1157 -
1158 - # TODO: failures specific to Python 2
1159 - sed -e 's:testLookupProcNetTcp:_&:' \
1160 - -i src/twisted/test/test_ident.py || die
1161 - sed -e 's:test_loggingFactoryOpensLogfileAutomatically:_&:' \
1162 - -i src/twisted/test/test_policies.py || die
1163 -
1164 - distutils-r1_python_prepare_all
1165 -}
1166 -
1167 -src_test() {
1168 - virtx distutils-r1_src_test
1169 -}
1170 -
1171 -python_test() {
1172 - # TODO: upstream seems to override our build paths
1173 - distutils_install_for_testing
1174 -
1175 - "${EPYTHON}" -m twisted.trial twisted ||
1176 - die "Tests failed with ${EPYTHON}"
1177 -}
1178 -
1179 -python_install() {
1180 - distutils-r1_python_install
1181 -
1182 - cd "${D}$(python_get_sitedir)" || die
1183 -
1184 - # own the dropin.cache so we don't leave orphans
1185 - touch twisted/plugins/dropin.cache || die
1186 -
1187 - python_doscript "${WORKDIR}"/twisted-regen-cache
1188 -}
1189 -
1190 -python_install_all() {
1191 - distutils-r1_python_install_all
1192 -
1193 - newconfd "${FILESDIR}/twistd.conf" twistd
1194 - newinitd "${FILESDIR}/twistd.init" twistd
1195 -}
1196 -
1197 -python_postinst() {
1198 - twisted-regen-cache || die
1199 -}
1200 -
1201 -pkg_postinst() {
1202 - python_foreach_impl python_postinst
1203 -
1204 - einfo "Install complete"
1205 - if use test ; then
1206 - einfo ""
1207 - einfo "Some tests have been disabled during testing due to"
1208 - einfo "known incompatibilities with the emerge sandboxes and/or"
1209 - einfo "not runnable as the root user."
1210 - einfo "For a complete test suite run on the code."
1211 - einfo "Run the tests as a normal user for each python it is installed to."
1212 - einfo " ie: $ python3.6 /usr/bin/trial twisted"
1213 - fi
1214 -}
1215 -
1216 -python_postrm() {
1217 - rm -f "${ROOT}$(python_get_sitedir)/twisted/plugins/dropin.cache" || die
1218 -}
1219 -
1220 -pkg_postrm() {
1221 - # if we're removing the last version, remove the cache file
1222 - if [[ ! ${REPLACING_VERSIONS} ]]; then
1223 - python_foreach_impl python_postrm
1224 - fi
1225 -}
1226
1227 diff --git a/dev-python/twisted/twisted-20.3.0.ebuild b/dev-python/twisted/twisted-20.3.0.ebuild
1228 deleted file mode 100644
1229 index 48c006ad930..00000000000
1230 --- a/dev-python/twisted/twisted-20.3.0.ebuild
1231 +++ /dev/null
1232 @@ -1,190 +0,0 @@
1233 -# Copyright 1999-2021 Gentoo Authors
1234 -# Distributed under the terms of the GNU General Public License v2
1235 -
1236 -EAPI=7
1237 -
1238 -PYTHON_COMPAT=( python3_{7,8,9} )
1239 -PYTHON_REQ_USE="threads(+)"
1240 -
1241 -inherit distutils-r1 virtualx
1242 -
1243 -TWISTED_PN="Twisted"
1244 -TWISTED_P="${TWISTED_PN}-${PV}"
1245 -TWISTED_RELEASE=$(ver_cut 1-2)
1246 -
1247 -DESCRIPTION="An asynchronous networking framework written in Python"
1248 -HOMEPAGE="https://www.twistedmatrix.com/trac/"
1249 -SRC_URI="https://twistedmatrix.com/Releases/${TWISTED_PN}"
1250 -SRC_URI="${SRC_URI}/${TWISTED_RELEASE}/${TWISTED_P}.tar.bz2
1251 - https://dev.gentoo.org/~mgorny/dist/twisted-regen-cache.gz"
1252 -
1253 -KEYWORDS="~alpha amd64 arm arm64 ~ia64 ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~x64-macos"
1254 -
1255 -LICENSE="MIT"
1256 -SLOT="0"
1257 -IUSE="conch crypt http2 serial test"
1258 -RESTRICT="!test? ( test )"
1259 -
1260 -RDEPEND="
1261 - >=dev-python/attrs-19.2.0[${PYTHON_USEDEP}]
1262 - >=dev-python/automat-0.3.0[${PYTHON_USEDEP}]
1263 - >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}]
1264 - >=dev-python/hyperlink-17.1.1[${PYTHON_USEDEP}]
1265 - >=dev-python/incremental-16.10.1[${PYTHON_USEDEP}]
1266 - >=dev-python/pyhamcrest-1.9.0[${PYTHON_USEDEP}]
1267 - >=dev-python/zope-interface-4.4.2[${PYTHON_USEDEP}]
1268 - conch? (
1269 - dev-python/pyasn1[${PYTHON_USEDEP}]
1270 - >=dev-python/cryptography-1.5.0[${PYTHON_USEDEP}]
1271 - >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}]
1272 - )
1273 - crypt? (
1274 - >=dev-python/pyopenssl-16.0.0[${PYTHON_USEDEP}]
1275 - dev-python/service_identity[${PYTHON_USEDEP}]
1276 - >=dev-python/idna-0.6[${PYTHON_USEDEP}]
1277 - )
1278 - serial? ( >=dev-python/pyserial-3.0[${PYTHON_USEDEP}] )
1279 - http2? (
1280 - >=dev-python/hyper-h2-3.0.0[${PYTHON_USEDEP}]
1281 - <dev-python/hyper-h2-4.0.0[${PYTHON_USEDEP}]
1282 - >=dev-python/priority-1.1.0[${PYTHON_USEDEP}]
1283 - <dev-python/priority-2.0[${PYTHON_USEDEP}]
1284 - )
1285 - !dev-python/twisted-core
1286 - !dev-python/twisted-conch
1287 - !dev-python/twisted-lore
1288 - !dev-python/twisted-mail
1289 - !dev-python/twisted-names
1290 - !dev-python/twisted-news
1291 - !dev-python/twisted-pair
1292 - !dev-python/twisted-runner
1293 - !dev-python/twisted-words
1294 - !dev-python/twisted-web
1295 -"
1296 -DEPEND="
1297 - dev-python/bcrypt
1298 - >=dev-python/incremental-16.10.1[${PYTHON_USEDEP}]
1299 - test? (
1300 - dev-python/gmpy[${PYTHON_USEDEP}]
1301 - dev-python/pyasn1[${PYTHON_USEDEP}]
1302 - >=dev-python/cryptography-0.9.1[${PYTHON_USEDEP}]
1303 - >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}]
1304 - >=dev-python/pyopenssl-0.13[${PYTHON_USEDEP}]
1305 - dev-python/service_identity[${PYTHON_USEDEP}]
1306 - dev-python/idna[${PYTHON_USEDEP}]
1307 - dev-python/pyserial[${PYTHON_USEDEP}]
1308 - >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}]
1309 - net-misc/openssh
1310 - )
1311 -"
1312 -
1313 -S=${WORKDIR}/${TWISTED_P}
1314 -
1315 -python_prepare_all() {
1316 - local PATCHES=(
1317 - "${FILESDIR}"/twisted-20.3.0-py38-cgi.patch
1318 - "${FILESDIR}"/twisted-20.3.0-py38-hmac.patch
1319 - "${FILESDIR}"/twisted-20.3.0-py39-b64.patch
1320 - "${FILESDIR}"/twisted-20.3.0-py39-combined.patch
1321 - )
1322 -
1323 - # upstream test for making releases; not very useful and requires
1324 - # sphinx (including on py2)
1325 - rm src/twisted/python/test/test_release.py || die
1326 -
1327 - # Conch doesn't work with latest >=OpenSSH 7.6
1328 - # - https://twistedmatrix.com/trac/ticket/9311
1329 - # - https://twistedmatrix.com/trac/ticket/9515
1330 - rm src/twisted/conch/test/test_ckeygen.py || die
1331 - rm src/twisted/conch/test/test_conch.py || die
1332 - rm src/twisted/conch/test/test_cftp.py || die
1333 -
1334 - # puts system in EMFILE state, then the exception handler may fail
1335 - # trying to open more files due to some gi magic
1336 - sed -e '/SKIP_EMFILE/s:None:"Fails on non-pristine systems":' \
1337 - -i src/twisted/internet/test/test_tcp.py || die
1338 -
1339 - # multicast tests fail within network-sandbox
1340 - sed -e 's:test_joinLeave:_&:' \
1341 - -e 's:test_loopback:_&:' \
1342 - -e 's:test_multiListen:_&:' \
1343 - -e 's:test_multicast:_&:' \
1344 - -i src/twisted/test/test_udp.py || die
1345 -
1346 - # accesses /dev/net/tun
1347 - sed -e '/class RealDeviceTestsMixin/a\
1348 - skip = "Requires extra permissions"' \
1349 - -i src/twisted/pair/test/test_tuntap.py || die
1350 -
1351 - # TODO: figure it out, probably doesn't accept DST date here
1352 - sed -e 's:test_getTimezoneOffsetWithoutDaylightSavingTime:_&:' \
1353 - -i src/twisted/test/test_log.py || die
1354 -
1355 - # TODO: failures specific to Python 2
1356 - sed -e 's:testLookupProcNetTcp:_&:' \
1357 - -i src/twisted/test/test_ident.py || die
1358 - sed -e 's:test_loggingFactoryOpensLogfileAutomatically:_&:' \
1359 - -i src/twisted/test/test_policies.py || die
1360 -
1361 - distutils-r1_python_prepare_all
1362 -}
1363 -
1364 -src_test() {
1365 - virtx distutils-r1_src_test
1366 -}
1367 -
1368 -python_test() {
1369 - # TODO: upstream seems to override our build paths
1370 - distutils_install_for_testing
1371 -
1372 - "${EPYTHON}" -m twisted.trial twisted ||
1373 - die "Tests failed with ${EPYTHON}"
1374 -}
1375 -
1376 -python_install() {
1377 - distutils-r1_python_install
1378 -
1379 - cd "${D}$(python_get_sitedir)" || die
1380 -
1381 - # own the dropin.cache so we don't leave orphans
1382 - touch twisted/plugins/dropin.cache || die
1383 -
1384 - python_doscript "${WORKDIR}"/twisted-regen-cache
1385 -}
1386 -
1387 -python_install_all() {
1388 - distutils-r1_python_install_all
1389 -
1390 - newconfd "${FILESDIR}/twistd.conf" twistd
1391 - newinitd "${FILESDIR}/twistd.init" twistd
1392 -}
1393 -
1394 -python_postinst() {
1395 - twisted-regen-cache || die
1396 -}
1397 -
1398 -pkg_postinst() {
1399 - python_foreach_impl python_postinst
1400 -
1401 - einfo "Install complete"
1402 - if use test ; then
1403 - einfo ""
1404 - einfo "Some tests have been disabled during testing due to"
1405 - einfo "known incompatibilities with the emerge sandboxes and/or"
1406 - einfo "not runnable as the root user."
1407 - einfo "For a complete test suite run on the code."
1408 - einfo "Run the tests as a normal user for each python it is installed to."
1409 - einfo " ie: $ python3.6 /usr/bin/trial twisted"
1410 - fi
1411 -}
1412 -
1413 -python_postrm() {
1414 - rm -f "${ROOT}$(python_get_sitedir)/twisted/plugins/dropin.cache" || die
1415 -}
1416 -
1417 -pkg_postrm() {
1418 - # if we're removing the last version, remove the cache file
1419 - if [[ ! ${REPLACING_VERSIONS} ]]; then
1420 - python_foreach_impl python_postrm
1421 - fi
1422 -}