aboutsummaryrefslogtreecommitdiffstats
path: root/community/py3-twisted
diff options
context:
space:
mode:
Diffstat (limited to 'community/py3-twisted')
-rw-r--r--community/py3-twisted/APKBUILD7
-rw-r--r--community/py3-twisted/fix-test-suite-python38.patch138
2 files changed, 142 insertions, 3 deletions
diff --git a/community/py3-twisted/APKBUILD b/community/py3-twisted/APKBUILD
index 4a00f41b02..4ba0572160 100644
--- a/community/py3-twisted/APKBUILD
+++ b/community/py3-twisted/APKBUILD
@@ -10,13 +10,13 @@ license="MIT"
depends="python3 py3-cryptography py3-zope-interface py3-constantly py3-incremental py3-attrs
py3-pyhamcrest py3-hyperlink py3-automat"
makedepends="libtirpc-dev py3-setuptools python3-dev cython"
-checkdepends="xvfb-run py3-appdirs tzdata"
+checkdepends="xvfb-run py3-appdirs tzdata py3-asn1 py3-bcrypt"
subpackages="$pkgname-doc"
source="https://twistedmatrix.com/Releases/$_pkgname/${pkgver%.*}/$_pkgname-$pkgver.tar.bz2
remove-locale-dependent-tests.patch
disable-failing-test.patch
+ fix-test-suite-python38.patch
"
-options="!check" # FIXME: fix python 3.8 support. for example hmac.HMAC needs the digestmod arg
builddir="$srcdir"/"$_pkgname"-$pkgver
replaces="py-twisted" # Backwards compatibility
@@ -57,4 +57,5 @@ doc() {
sha512sums="46588008f0be63f9ec8cfb88bb81f4268e59e8dead8256c36144b521eb3e58726f4d8c9016b7157365b26929e39a3fa6ff2cc2a9f83e8cfa7f1acc43d31297c4 Twisted-19.7.0.tar.bz2
b8532d6ad572c7f13cddce35e2aa03d28b7e2b22ace7976e92e617aa26f15ea518f8cbd5efd560f841a585356323815d39257a49b39c9caae505ceff44c4435c remove-locale-dependent-tests.patch
-2bacc91852875fa0b090e0a685204846485b32e3c41a4b0b933c90cf6736ba1a34bd04c3151dae256a1b2046c757985952bb050565b8dcd428199a9f7ddbcfca disable-failing-test.patch"
+2bacc91852875fa0b090e0a685204846485b32e3c41a4b0b933c90cf6736ba1a34bd04c3151dae256a1b2046c757985952bb050565b8dcd428199a9f7ddbcfca disable-failing-test.patch
+6819dae640c64d81858603d02299dd73d9bfd38dbb36ca7a9af97fb2315bee29f40035aabe4b4c4323a963fcdbc878bd4d81ef6ac8210b249d2fcb89f45d732c fix-test-suite-python38.patch"
diff --git a/community/py3-twisted/fix-test-suite-python38.patch b/community/py3-twisted/fix-test-suite-python38.patch
new file mode 100644
index 0000000000..89faa9640b
--- /dev/null
+++ b/community/py3-twisted/fix-test-suite-python38.patch
@@ -0,0 +1,138 @@
+Fix test failures that happen due to changes in python 3.8
+
+diff --git a/src/twisted/cred/credentials.py b/src/twisted/cred/credentials.py
+index b55985b6cd..429706ccc7 100644
+--- a/src/twisted/cred/credentials.py
++++ b/src/twisted/cred/credentials.py
+@@ -439,7 +439,7 @@ class CramMD5Credentials(object):
+
+
+ def checkPassword(self, password):
+- verify = hexlify(hmac.HMAC(password, self.challenge).digest())
++ verify = hexlify(hmac.HMAC(password, self.challenge, 'md5').digest())
+ return verify == self.response
+
+
+diff --git a/src/twisted/mail/_cred.py b/src/twisted/mail/_cred.py
+index 9d3646948f..1be9fb2976 100644
+--- a/src/twisted/mail/_cred.py
++++ b/src/twisted/mail/_cred.py
+@@ -28,7 +28,7 @@ class CramMD5ClientAuthenticator:
+
+
+ def challengeResponse(self, secret, chal):
+- response = hmac.HMAC(secret, chal).hexdigest().encode('ascii')
++ response = hmac.HMAC(secret, chal, 'md5').hexdigest().encode('ascii')
+ return self.user + b' ' + response
+
+
+diff --git a/src/twisted/mail/test/test_pop3.py b/src/twisted/mail/test/test_pop3.py
+index 6eb7ecb287..a9895b192f 100644
+--- a/src/twisted/mail/test/test_pop3.py
++++ b/src/twisted/mail/test/test_pop3.py
+@@ -939,7 +939,7 @@ class SASLTests(unittest.TestCase):
+ p.lineReceived(b"AUTH CRAM-MD5")
+ chal = s.getvalue().splitlines()[-1][2:]
+ chal = base64.decodestring(chal)
+- response = hmac.HMAC(b'testpassword', chal).hexdigest().encode("ascii")
++ response = hmac.HMAC(b'testpassword', chal, 'md5').hexdigest().encode("ascii")
+
+ p.lineReceived(
+ base64.encodestring(b'testuser ' + response).rstrip(b'\n'))
+diff --git a/src/twisted/cred/test/test_cramauth.py b/src/twisted/cred/test/test_cramauth.py
+index 1ee08712b6..6db48da3b1 100644
+--- a/src/twisted/cred/test/test_cramauth.py
++++ b/src/twisted/cred/test/test_cramauth.py
+@@ -39,7 +39,7 @@ class CramMD5CredentialsTests(TestCase):
+ """
+ c = CramMD5Credentials()
+ chal = c.getChallenge()
+- c.response = hexlify(HMAC(b'secret', chal).digest())
++ c.response = hexlify(HMAC(b'secret', chal, 'md5').digest())
+ self.assertTrue(c.checkPassword(b'secret'))
+
+
+@@ -61,7 +61,7 @@ class CramMD5CredentialsTests(TestCase):
+ """
+ c = CramMD5Credentials()
+ chal = c.getChallenge()
+- c.response = hexlify(HMAC(b'thewrongsecret', chal).digest())
++ c.response = hexlify(HMAC(b'thewrongsecret', chal, 'md5').digest())
+ self.assertFalse(c.checkPassword(b'secret'))
+
+
+@@ -75,7 +75,7 @@ class CramMD5CredentialsTests(TestCase):
+ chal = c.getChallenge()
+ c.setResponse(b" ".join(
+ (b"squirrel",
+- hexlify(HMAC(b'supersecret', chal).digest()))))
++ hexlify(HMAC(b'supersecret', chal, 'md5').digest()))))
+ self.assertTrue(c.checkPassword(b'supersecret'))
+ self.assertEqual(c.username, b"squirrel")
+
+diff --git a/src/twisted/web/test/test_http.py b/src/twisted/web/test/test_http.py
+index 6527e799c7..0c9d9b82ba 100644
+--- a/src/twisted/web/test/test_http.py
++++ b/src/twisted/web/test/test_http.py
+@@ -7,7 +7,7 @@ Test HTTP support.
+
+ from __future__ import absolute_import, division
+
+-import random, cgi, base64, calendar
++import random, cgi, urllib.parse, base64, calendar
+
+ try:
+ from urlparse import urlparse, urlunsplit, clear_cache
+@@ -2081,15 +2081,15 @@ Hello,
+ class QueryArgumentsTests(unittest.TestCase):
+ def testParseqs(self):
+ self.assertEqual(
+- cgi.parse_qs(b"a=b&d=c;+=f"),
++ urllib.parse.parse_qs(b"a=b&d=c;+=f"),
+ http.parse_qs(b"a=b&d=c;+=f"))
+ self.assertRaises(
+ ValueError, http.parse_qs, b"blah", strict_parsing=True)
+ self.assertEqual(
+- cgi.parse_qs(b"a=&b=c", keep_blank_values=1),
++ urllib.parse.parse_qs(b"a=&b=c", keep_blank_values=1),
+ http.parse_qs(b"a=&b=c", keep_blank_values=1))
+ self.assertEqual(
+- cgi.parse_qs(b"a=&b=c"),
++ urllib.parse.parse_qs(b"a=&b=c"),
+ http.parse_qs(b"a=&b=c"))
+
+
+diff --git a/src/twisted/conch/test/test_ckeygen.py b/src/twisted/conch/test/test_ckeygen.py
+index a8400857c7..257ec99855 100644
+--- a/src/twisted/conch/test/test_ckeygen.py
++++ b/src/twisted/conch/test/test_ckeygen.py
+@@ -89,13 +89,14 @@ class KeyGenTests(TestCase):
+ self._testrun('rsa', '2048')
+ self._testrun('rsa')
+
+-
++ test_keygeneration.skip = "ckeygen binary not available"
+
+ def test_runBadKeytype(self):
+ filename = self.mktemp()
+ with self.assertRaises(subprocess.CalledProcessError):
+ subprocess.check_call(['ckeygen', '-t', 'foo', '-f', filename])
+
++ test_runBadKeytype.skip = "ckeygen binary not available"
+
+
+ def test_enumrepresentation(self):
+diff --git a/src/twisted/words/xish/domish.py b/src/twisted/words/xish/domish.py
+index 2063c410a3..e264b11e16 100644
+--- a/src/twisted/words/xish/domish.py
++++ b/src/twisted/words/xish/domish.py
+@@ -807,7 +807,8 @@ class ExpatElementStream:
+ qname = ('', name)
+
+ # Process attributes
+- for k, v in attrs.items():
++ _attrs = dict(attrs)
++ for k, v in _attrs.items():
+ if " " in k:
+ aqname = k.rsplit(" ", 1)
+ attrs[(aqname[0], aqname[1])] = v