diff options
Diffstat (limited to 'dev-python/twisted')
-rw-r--r-- | dev-python/twisted/Manifest | 8 | ||||
-rw-r--r-- | dev-python/twisted/files/twisted-20.3.0-py38-cgi.patch | 259 | ||||
-rw-r--r-- | dev-python/twisted/files/twisted-20.3.0-py38-hmac.patch | 94 | ||||
-rw-r--r-- | dev-python/twisted/twisted-18.4.0.ebuild | 7 | ||||
-rw-r--r-- | dev-python/twisted/twisted-19.10.0.ebuild | 74 | ||||
-rw-r--r-- | dev-python/twisted/twisted-20.3.0.ebuild | 181 |
6 files changed, 587 insertions, 36 deletions
diff --git a/dev-python/twisted/Manifest b/dev-python/twisted/Manifest index 6a04efd1af8f..b6a5de1487e3 100644 --- a/dev-python/twisted/Manifest +++ b/dev-python/twisted/Manifest @@ -7,12 +7,16 @@ AUX twisted-16.6.0-test-fixes.patch 10591 BLAKE2B 27729db1ce4b84ea66acfa12bfdf22 AUX twisted-17.9.0-Fix-test-on-Python-363.patch 3490 BLAKE2B 421318533759dad2d4ad3f054fbfab7900362aa3b3ca0adc75fb42431272fcaa40fe85ab2a3417232d97d3389b380ae658ee5b475e087f3a6097e28dd2094111 SHA512 0ba6b68267418bee3b2cfb15937dab4d6d3291725dd7acc41f37e0c8d39218acc4e23cb704c292f62eea57a128a1fcee6899826601b6763f37800c4b83ad18a8 AUX twisted-17.9.0-python-27-utf-8-fix.patch 1630 BLAKE2B c70f3223b66a9372e07df7a767937d77a07f91cafecb4a5d84452f57458516e3ef17e4d5862d6b9f003e0edce3391e282f5bfcaf57ff2029db3c499fc6e97262 SHA512 635c498ab0e612b7d7ab262c333f18408e22dbe95d86389e87da36f0c41cee90f25b4c1df626cb755932c970a9f12dc25ca67e3790bd9c15c8a4d8ee6f547956 AUX twisted-18.4.0-Disable-writing-of-plugin-cache.patch 853 BLAKE2B f2f4f3906266199856056d4eae062aafaa8d5b574858bd494d6a51512ad3f27ee0d813de8a760fbd21bdf479fde0bb1c3e724e13bddceb0d3af83bb8ecb31aa6 SHA512 e27a61855523a64c27e7adfe8ec917fae60149b1bfe0fc555694dc4321669665116046baa8f293d75b4bf68ec19743850062132aa05fed5feab4f582cc75219c +AUX twisted-20.3.0-py38-cgi.patch 8601 BLAKE2B 6eb76eaa1cfe10ba473a334bfd5e5a4c760739550c4aeba5cf68cbf380ca7f24725e102cf0f75b7a384faf639e03d9e80c11e0cc56339319329207a6342a8d55 SHA512 9877f4e3c0ad6d438cb046a04e60affbcbe7b263d06128ec6ea4d726194b044bf9f6c68891373624b435fb434fc878220834d038180d3d203defe31dab44710c +AUX twisted-20.3.0-py38-hmac.patch 3484 BLAKE2B b89587da906517a621ba880eb6eb71cc2f397a7bcf7bcf065f79897626f821d965b2daa0d105af7e48c8c30fb79fb836c02db17058b5ac046ae92f9578899a62 SHA512 a6ed24994bf76a7e602144eed706c61cce531408db050dc2a497fb4131b5594f4d29ebd34c0d780b283460d130dfc88b19ad9cbe5436c0290b9b13eb35c9342b AUX utf8_overrides.patch 2288 BLAKE2B 450f921f6a07cd56d9311c15c9f2bf342ec82c807325ebb5b5c2fd61572d489ac7f1c8978892530016a343b7284c580def705127c57ce947a2698835e447b8ce SHA512 b495268282e0233c570655b2b3d42ecc90116b22c36cdec4ebf581ce1019abedb7ee301d860ec161b4b5e691d1b747ad45257966b5f510de8dcce8271021e7e8 DIST Twisted-16.6.0.tar.bz2 2979747 BLAKE2B 898e0a0fa3ae8547a801b09118423ec8ad80727dd6d034e3f8a151f084eff5a3fc560f2eb9e76c452a14ec90b36d93e14d3bbb388010c3c5c01fd1c4d5ca16bb SHA512 0b8de0ec7f64457f76c396fced64b366b8e63c6e000a5edc6c6388cd917fb2f95711918cd8edda39e0aa77e2cd32b5d775d23630a5ad10fc013c18f8316300cf DIST Twisted-18.4.0.tar.bz2 3037019 BLAKE2B 6fc32f7591493ccc4fe03233307b566899b82cd035ba3329b3faaf950339a6653de697ba3873b37b22f9d7f8a66109694b80496917bf61e79c56eeb7e351ac87 SHA512 3733a6df0196ea580187da3576f5fd08f287437528a4e19813056d019cca213c61b62d879d80a12eef38661d3505ba33aac9a4fc956b19afa6da7d37a6465c83 DIST Twisted-19.10.0.tar.bz2 3118485 BLAKE2B a0d532b67177aa017e463bf823d7842d4f6ff694f78cd7600865718ffe861023a53ea6a922f7de232133edba26f5255074d7ef277ce8f3bdf02d556ccf4abf41 SHA512 de8d7fd0b2081cebeff68b060c8469377011648bc563a94a993d3530fb007ed42c3a54925c9a10c465ee7a3065cc9108ace12d10d358223fab13494becb9ac4b +DIST Twisted-20.3.0.tar.bz2 3127793 BLAKE2B 2e85fc3ec26d89e563c9e79a5d2adea81ff1745d18f0f92b8d45ae3729fbddf09998664257880372c7a4caeb5977c5cad7c863596b8c27ad7890275cead9f763 SHA512 1b850e5fc21a3630ead4c2cc3622c16e78bb3be38ab11d021779b7ce3d3c30acc4e19d79c7791a5fce6c5c6e09c2baa349901dffe952de67dd98eec419846365 DIST twisted-regen-cache.gz 911 BLAKE2B ffd3fcda6c67ffe6fd3ef581c8d507548396b66ed0708e9a5c790095e579c0d5f0f71596acf05712989da2ddef2b8d437eca973bc4d80ef8a9fa852915f38305 SHA512 95a9b931c73017d16d1b5e6b41345dddffe62b6af1a8e93b5e40d06d3d15be17b0dd0181c767ffeeb791534d463764ef9e066fa6c2ee2ac4b53c86d1da8fce03 EBUILD twisted-16.6.0-r3.ebuild 5783 BLAKE2B e6433d34015f3140e93ac698aaaaae9fa822de410debaa5bce42ffc5697e9c11ed0c3180ce8212703746addda39d9b0d4c30dbbef348fb821a65cc6e24d8701d SHA512 181151b8b2667f688fa08ce7aa97e2fc242c8dd168cc5498d17f6224ce18933406ddcf40a8c813a0631f4cd58e498c370d94371043c41d4b18aa44876677b979 -EBUILD twisted-18.4.0.ebuild 5948 BLAKE2B 5b0fc4f2220a614c50d559c64ba476f7d89e0ecdaf5b8ff78c02dddf80ec6bac7bd589614752c976c8b88452bc79421ce7253f1c12f4ffddf58a8b360c01de0a SHA512 ef25479cfc00a25c4327d231dd91e10923a53ebf4b5dae9eb6e072b3082d1c58bc0766dc6bbe8e847f76fa2f5b26075c2df126b2456e0f15ed2056289d97c47a -EBUILD twisted-19.10.0.ebuild 5219 BLAKE2B 350fb35125418d99e15aaa9214cfcbb9a28ec2a92d2915e3e852a889c3293009f73d521ba41d71d84a38b07a76f14fbe0222baa5e66f71d34dca427a4b2620a0 SHA512 796895d71de1a75ac3cbb7de8b019f6497146de3f2cc0a7c86cd6dad7ac355fba3f3b0bec5e5699b97c910530ce9f06233c2d232c1f0eb2dc1de14087f829b2d +EBUILD twisted-18.4.0.ebuild 6270 BLAKE2B edbeb59373d55d728b255223dd7ca09043547c80513be779719704983508dd2be866e4fee90bb023f8817f95659291c262b4d037ba6609164a61d13dd660e5e4 SHA512 ae8aede1151acaa3f94553bdcefc25970e9026f4aef8a81c6a6f8f0a0e7d9c91283ff6eaf1aeb2ed8140021279ed3a985967fd6357b8ad239289604a9cc0a2a5 +EBUILD twisted-19.10.0.ebuild 5325 BLAKE2B bd98bd08ea62530761f7f75918735e1926a29cbcb8ad6e3521001afdc7bdb02d1eba260cc74995bf36e7e142f3a84b933f646db54165e26f50fa12b24b844dc0 SHA512 b779e7af21e8afee8cfeaae8603207f8de83d6564e01800158decbe7fdcbd6079ddd0b6aa14141c301bb23fe15a6bb488531de9607b079d309594b5fc483e4fd +EBUILD twisted-20.3.0.ebuild 5209 BLAKE2B 00b96a61aeaa7efaa34ec6b1eb2782c25cd9f0d3f90a6567d7c6e95c4fd301c9a01059bcd688fc71c5220cc232d493445e47ef1cb754f21812f65cc074a87d14 SHA512 e181af544506d4aebdac748c68ca6e56fbaac4627d5518716c62c589e639fa3cef2560402dff950e9e5d1cb854d963a95988be04329ed5e9369de88aa7e68a4b MISC metadata.xml 1351 BLAKE2B b3a4ccdc922dd4aa902b24b2545f3cc5517b2842c92f1195e8eaa2a8b62558c1ea86059cc23b9ad6a8e6093216a11a01f46360b5ba259e5eadcb351ad3bc0094 SHA512 403d692122913d079c5a93cb5b226f33316776360663a171cd757584d219d0789b24809c9e65840aaeb63eae4cb7cc79258757837abb1e3dd92536369fff6604 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 new file mode 100644 index 000000000000..5151f297f7f4 --- /dev/null +++ b/dev-python/twisted/files/twisted-20.3.0-py38-cgi.patch @@ -0,0 +1,259 @@ +From 62ab0203c59c1f9788c53dfad4a212774094d05c Mon Sep 17 00:00:00 2001 +From: Craig Rodrigues <rodrigc@FreeBSD.org> +Date: Mon, 13 Apr 2020 01:22:23 -0700 +Subject: [PATCH 2/2] Merge 9801-rodrigc-cgi: Change import of cgi.parse_qs to + urllib.parse.parse_qs + +Author: rodrigc +Reviewer: hawkowl +Fixes: ticket:9801 +--- + src/twisted/web/client.py | 17 ++++----- + src/twisted/web/http.py | 49 ++++++++++++------------- + src/twisted/web/newsfragments/9801.misc | 0 + src/twisted/web/test/test_http.py | 41 +++------------------ + src/twisted/web/test/test_webclient.py | 5 +-- + 5 files changed, 38 insertions(+), 74 deletions(-) + create mode 100644 src/twisted/web/newsfragments/9801.misc + +diff --git a/src/twisted/web/client.py b/src/twisted/web/client.py +index 7e4642ef3..8209f5a5e 100644 +--- a/src/twisted/web/client.py ++++ b/src/twisted/web/client.py +@@ -12,15 +12,8 @@ import os + import collections + import warnings + +-try: +- from urlparse import urlunparse, urljoin, urldefrag +-except ImportError: +- from urllib.parse import urljoin, urldefrag +- from urllib.parse import urlunparse as _urlunparse +- +- def urlunparse(parts): +- result = _urlunparse(tuple([p.decode("charmap") for p in parts])) +- return result.encode("charmap") ++from urllib.parse import urljoin, urldefrag ++from urllib.parse import urlunparse as _urlunparse + + import zlib + from functools import wraps +@@ -51,6 +44,12 @@ from twisted.web._newclient import _ensureValidURI, _ensureValidMethod + + + ++def urlunparse(parts): ++ result = _urlunparse(tuple([p.decode("charmap") for p in parts])) ++ return result.encode("charmap") ++ ++ ++ + class PartialDownloadError(error.Error): + """ + Page was only partially downloaded, we got disconnected in middle. +diff --git a/src/twisted/web/http.py b/src/twisted/web/http.py +index b7afa8b0d..94d0ae81f 100644 +--- a/src/twisted/web/http.py ++++ b/src/twisted/web/http.py +@@ -66,27 +66,10 @@ import time + import calendar + import warnings + import os +-from io import BytesIO as StringIO +- +-try: +- from urlparse import ( +- ParseResult as ParseResultBytes, urlparse as _urlparse) +- from urllib import unquote +- from cgi import parse_header as _parseHeader +-except ImportError: +- from urllib.parse import ( +- ParseResultBytes, urlparse as _urlparse, unquote_to_bytes as unquote) +- +- def _parseHeader(line): +- # cgi.parse_header requires a str +- key, pdict = cgi.parse_header(line.decode('charmap')) +- +- # We want the key as bytes, and cgi.parse_multipart (which consumes +- # pdict) expects a dict of str keys but bytes values +- key = key.encode('charmap') +- pdict = {x:y.encode('charmap') for x, y in pdict.items()} +- return (key, pdict) ++from io import BytesIO + ++from urllib.parse import ( ++ ParseResultBytes, urlparse as _urlparse, unquote_to_bytes as unquote) + + from zope.interface import Attribute, Interface, implementer, provider + +@@ -163,6 +146,20 @@ monthname = [None, + weekdayname_lower = [name.lower() for name in weekdayname] + monthname_lower = [name and name.lower() for name in monthname] + ++ ++ ++def _parseHeader(line): ++ # cgi.parse_header requires a str ++ key, pdict = cgi.parse_header(line.decode('charmap')) ++ ++ # We want the key as bytes, and cgi.parse_multipart (which consumes ++ # pdict) expects a dict of str keys but bytes values ++ key = key.encode('charmap') ++ pdict = {x: y.encode('charmap') for x, y in pdict.items()} ++ return (key, pdict) ++ ++ ++ + def urlparse(url): + """ + Parse an URL into six components. +@@ -486,13 +483,15 @@ class _IDeprecatedHTTPChannelToRequestInterface(Interface): + + class StringTransport: + """ +- I am a StringIO wrapper that conforms for the transport API. I support ++ I am a BytesIO wrapper that conforms for the transport API. I support + the `writeSequence' method. + """ + def __init__(self): +- self.s = StringIO() ++ self.s = BytesIO() ++ + def writeSequence(self, seq): + self.s.write(b''.join(seq)) ++ + def __getattr__(self, attr): + return getattr(self.__dict__['s'], attr) + +@@ -513,7 +512,7 @@ class HTTPClient(basic.LineReceiver): + @type firstLine: C{bool} + + @ivar __buffer: The buffer that stores the response to the HTTP request. +- @type __buffer: A C{StringIO} object. ++ @type __buffer: A C{BytesIO} object. + + @ivar _header: Part or all of an HTTP request header. + @type _header: C{bytes} +@@ -579,7 +578,7 @@ class HTTPClient(basic.LineReceiver): + if self._header != b"": + # Only extract headers if there are any + self.extractHeader(self._header) +- self.__buffer = StringIO() ++ self.__buffer = BytesIO() + self.handleEndHeaders() + self.setRawMode() + return +@@ -665,7 +664,7 @@ def _getContentFile(length): + Get a writeable file-like object to which request content can be written. + """ + if length is not None and length < 100000: +- return StringIO() ++ return BytesIO() + return tempfile.TemporaryFile() + + +diff --git a/src/twisted/web/newsfragments/9801.misc b/src/twisted/web/newsfragments/9801.misc +new file mode 100644 +index 000000000..e69de29bb +diff --git a/src/twisted/web/test/test_http.py b/src/twisted/web/test/test_http.py +index a3067f732..4189b307c 100644 +--- a/src/twisted/web/test/test_http.py ++++ b/src/twisted/web/test/test_http.py +@@ -9,15 +9,11 @@ from __future__ import absolute_import, division + + import base64 + import calendar +-import cgi + import random + + import hamcrest + +-try: +- from urlparse import urlparse, urlunsplit, clear_cache +-except ImportError: +- from urllib.parse import urlparse, urlunsplit, clear_cache ++from urllib.parse import urlparse, urlunsplit, clear_cache, parse_qs + + from io import BytesIO + from itertools import cycle +@@ -28,7 +24,7 @@ from zope.interface import ( + ) + from zope.interface.verify import verifyObject + +-from twisted.python.compat import (_PY3, iterbytes, long, networkString, ++from twisted.python.compat import (iterbytes, long, networkString, + unicode, intToBytes) + from twisted.python.components import proxyForInterface + from twisted.python.failure import Failure +@@ -2019,33 +2015,6 @@ Content-Type: application/x-www-form-urlencoded + self.assertEqual(content, [networkString(query)]) + + +- def test_missingContentDisposition(self): +- """ +- If the C{Content-Disposition} header is missing, the request is denied +- as a bad request. +- """ +- req = b'''\ +-POST / HTTP/1.0 +-Content-Type: multipart/form-data; boundary=AaB03x +-Content-Length: 103 +- +---AaB03x +-Content-Type: text/plain +-Content-Transfer-Encoding: quoted-printable +- +-abasdfg +---AaB03x-- +-''' +- channel = self.runRequest(req, http.Request, success=False) +- self.assertEqual( +- channel.transport.value(), +- b"HTTP/1.1 400 Bad Request\r\n\r\n") +- +- if _PY3: +- test_missingContentDisposition.skip = ( +- "cgi.parse_multipart is much more error-tolerant on Python 3.") +- +- + def test_multipartProcessingFailure(self): + """ + When the multipart processing fails the client gets a 400 Bad Request. +@@ -2373,15 +2342,15 @@ ok + class QueryArgumentsTests(unittest.TestCase): + def testParseqs(self): + self.assertEqual( +- cgi.parse_qs(b"a=b&d=c;+=f"), ++ 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), ++ 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"), ++ parse_qs(b"a=&b=c"), + http.parse_qs(b"a=&b=c")) + + +diff --git a/src/twisted/web/test/test_webclient.py b/src/twisted/web/test/test_webclient.py +index 680e02780..672594993 100644 +--- a/src/twisted/web/test/test_webclient.py ++++ b/src/twisted/web/test/test_webclient.py +@@ -11,10 +11,7 @@ import io + import os + from errno import ENOSPC + +-try: +- from urlparse import urlparse, urljoin +-except ImportError: +- from urllib.parse import urlparse, urljoin ++from urllib.parse import urlparse, urljoin + + from twisted.python.compat import networkString, nativeString, intToBytes + from twisted.trial import unittest, util +-- +2.26.2 + 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 new file mode 100644 index 000000000000..1c1ee01b2187 --- /dev/null +++ b/dev-python/twisted/files/twisted-20.3.0-py38-hmac.patch @@ -0,0 +1,94 @@ +From 653fb2aea0ca1f60558917d52f4ff0c33cd7b067 Mon Sep 17 00:00:00 2001 +From: Craig Rodrigues <rodrigc@crodrigues.org> +Date: Sun, 12 Apr 2020 14:28:23 -0700 +Subject: [PATCH 1/2] Add digestmod parameter to HMAC.__init__() invocations + +This parameter is now required on Python 3.8+ +--- + src/twisted/cred/credentials.py | 3 ++- + src/twisted/cred/test/test_cramauth.py | 11 ++++++++--- + src/twisted/mail/test/test_pop3.py | 4 +++- + 3 files changed, 13 insertions(+), 5 deletions(-) + +diff --git a/src/twisted/cred/credentials.py b/src/twisted/cred/credentials.py +index 5469e5158..67c24cb01 100644 +--- a/src/twisted/cred/credentials.py ++++ b/src/twisted/cred/credentials.py +@@ -441,7 +441,8 @@ class CramMD5Credentials(object): + + + def checkPassword(self, password): +- verify = hexlify(hmac.HMAC(password, self.challenge).digest()) ++ verify = hexlify(hmac.HMAC(password, self.challenge, ++ digestmod=md5).digest()) + return verify == self.response + + +diff --git a/src/twisted/cred/test/test_cramauth.py b/src/twisted/cred/test/test_cramauth.py +index 1ee08712b..d21f2f68c 100644 +--- a/src/twisted/cred/test/test_cramauth.py ++++ b/src/twisted/cred/test/test_cramauth.py +@@ -7,6 +7,8 @@ Tests for L{twisted.cred}'s implementation of CRAM-MD5. + + from __future__ import division, absolute_import + ++import hashlib ++ + from hmac import HMAC + from binascii import hexlify + +@@ -39,7 +41,8 @@ class CramMD5CredentialsTests(TestCase): + """ + c = CramMD5Credentials() + chal = c.getChallenge() +- c.response = hexlify(HMAC(b'secret', chal).digest()) ++ c.response = hexlify(HMAC(b'secret', chal, ++ digestmod=hashlib.md5).digest()) + self.assertTrue(c.checkPassword(b'secret')) + + +@@ -61,7 +64,8 @@ class CramMD5CredentialsTests(TestCase): + """ + c = CramMD5Credentials() + chal = c.getChallenge() +- c.response = hexlify(HMAC(b'thewrongsecret', chal).digest()) ++ c.response = hexlify(HMAC(b'thewrongsecret', chal, ++ digestmod=hashlib.md5).digest()) + self.assertFalse(c.checkPassword(b'secret')) + + +@@ -75,7 +79,8 @@ class CramMD5CredentialsTests(TestCase): + chal = c.getChallenge() + c.setResponse(b" ".join( + (b"squirrel", +- hexlify(HMAC(b'supersecret', chal).digest())))) ++ hexlify(HMAC(b'supersecret', chal, ++ digestmod=hashlib.md5).digest())))) + self.assertTrue(c.checkPassword(b'supersecret')) + self.assertEqual(c.username, b"squirrel") + +diff --git a/src/twisted/mail/test/test_pop3.py b/src/twisted/mail/test/test_pop3.py +index 4a59c3b49..ea513487c 100644 +--- a/src/twisted/mail/test/test_pop3.py ++++ b/src/twisted/mail/test/test_pop3.py +@@ -11,6 +11,7 @@ import hmac + import base64 + import itertools + ++from hashlib import md5 + from collections import OrderedDict + from io import BytesIO + +@@ -1097,7 +1098,8 @@ 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, ++ digestmod=md5).hexdigest().encode("ascii") + + p.lineReceived( + base64.encodestring(b'testuser ' + response).rstrip(b'\n')) +-- +2.26.2 + diff --git a/dev-python/twisted/twisted-18.4.0.ebuild b/dev-python/twisted/twisted-18.4.0.ebuild index 16b017e9f050..131a2e05578d 100644 --- a/dev-python/twisted/twisted-18.4.0.ebuild +++ b/dev-python/twisted/twisted-18.4.0.ebuild @@ -74,7 +74,6 @@ DEPEND=" dev-python/idna[${PYTHON_USEDEP}] dev-python/pyserial[${PYTHON_USEDEP}] >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}] - <net-misc/openssh-7.6 ) " @@ -96,6 +95,12 @@ python_prepare_all() { if use test ; then # Remove since this is an upstream distribution test for making releases rm src/twisted/python/test/test_release.py || die "rm src/twisted/python/test/test_release.py FAILED" + + # Conch doesn't work with latest >=OpenSSH 7.6 + # - https://twistedmatrix.com/trac/ticket/9311 + # - https://twistedmatrix.com/trac/ticket/9515 + rm src/twisted/conch/test/test_conch.py || die "rm src/twisted/conch/test/test_conch.py FAILED" + rm src/twisted/conch/test/test_cftp.py || die "rm src/twisted/conch/test/test_cftp.py FAILED" fi distutils-r1_python_prepare_all } diff --git a/dev-python/twisted/twisted-19.10.0.ebuild b/dev-python/twisted/twisted-19.10.0.ebuild index 7dc1cb2ddc54..1112e8b1d49f 100644 --- a/dev-python/twisted/twisted-19.10.0.ebuild +++ b/dev-python/twisted/twisted-19.10.0.ebuild @@ -6,7 +6,7 @@ EAPI=7 PYTHON_COMPAT=( python2_7 python3_{6,7,8} ) PYTHON_REQ_USE="threads(+)" -inherit distutils-r1 +inherit distutils-r1 virtualx TWISTED_PN="Twisted" TWISTED_P="${TWISTED_PN}-${PV}" @@ -82,46 +82,54 @@ DEPEND=" S=${WORKDIR}/${TWISTED_P} python_prepare_all() { - # No allowed tests are garaunteed to work on py3.5 or py3.8 - if use test ; then - # Remove since this is an upstream distribution test for making releases - rm src/twisted/python/test/test_release.py || die "rm src/twisted/python/test/test_release.py FAILED" - - # Remove these as they are known to fail -- fix (py2.7 - py3.6) - rm src/twisted/conch/test/test_ckeygen.py || die "rm src/twisted/conch/test/test_ckeygen.py FAILED" - rm src/twisted/pair/test/test_tuntap.py || die "rm src/twisted/pair/test/test_tuntap.py FAILED" - rm src/twisted/test/test_log.py || die "rm src/twisted/test/test_log.py FAILED" + # upstream test for making releases; not very useful and requires + # sphinx (including on py2) + rm src/twisted/python/test/test_release.py || die + + # puts system in EMFILE state, then the exception handler may fail + # trying to open more files due to some gi magic + sed -e '/SKIP_EMFILE/s:None:"Fails on non-pristine systems":' \ + -i src/twisted/internet/test/test_tcp.py || die + + # TODO: times out, i can't find where to increase the timeout + sed -e 's:test_manyProcesses:_&:' \ + -i src/twisted/test/test_process.py || die + + # multicast tests fail within network-sandbox + sed -e 's:test_joinLeave:_&:' \ + -e 's:test_loopback:_&:' \ + -e 's:test_multiListen:_&:' \ + -e 's:test_multicast:_&:' \ + -i src/twisted/test/test_udp.py || die + + # accesses /dev/net/tun + sed -e '/class RealDeviceTestsMixin/a\ + skip = "Requires extra permissions"' \ + -i src/twisted/pair/test/test_tuntap.py || die + + # TODO: figure it out, probably doesn't accept DST date here + sed -e 's:test_getTimezoneOffsetWithoutDaylightSavingTime:_&:' \ + -i src/twisted/test/test_log.py || die + + # TODO: failures specific to Python 2 + sed -e 's:testLookupProcNetTcp:_&:' \ + -i src/twisted/test/test_ident.py || die + sed -e 's:test_loggingFactoryOpensLogfileAutomatically:_&:' \ + -i src/twisted/test/test_policies.py || die - # This test fails only on py3.7 - rm src/twisted/internet/test/test_process.py || die " rm src/twisted/internet/test/test_process.py FAILED" - fi distutils-r1_python_prepare_all } +src_test() { + virtx distutils-r1_src_test +} + python_test() { + # TODO: upstream seems to override our build paths distutils_install_for_testing - # workaround for the eclass not installing the entry points - # in the test environment. copy the old 16.3.2 start script - # to run the tests with - cp "${FILESDIR}"/trial "${TEST_DIR}" || die - chmod +x "${TEST_DIR}"/trial || die - - pushd "${TEST_DIR}" > /dev/null || die - - if ! "${TEST_DIR}"/trial twisted; then + "${EPYTHON}" -m twisted.trial twisted || die "Tests failed with ${EPYTHON}" - fi - - if ! "${TEST_DIR}"/trial twisted.test.test_twistd.DaemonizeTests; then - die "DaemonizeTests failed with ${EPYTHON}" - fi - - if ! "${TEST_DIR}"/trial twisted.test.test_reflect.SafeStrTests; then - die "SafeStrTests failed with ${EPYTHON}" - fi - - popd > /dev/null || die } python_install() { diff --git a/dev-python/twisted/twisted-20.3.0.ebuild b/dev-python/twisted/twisted-20.3.0.ebuild new file mode 100644 index 000000000000..1f547fbdba48 --- /dev/null +++ b/dev-python/twisted/twisted-20.3.0.ebuild @@ -0,0 +1,181 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python2_7 python3_{6,7,8} ) +PYTHON_REQ_USE="threads(+)" + +inherit distutils-r1 virtualx + +TWISTED_PN="Twisted" +TWISTED_P="${TWISTED_PN}-${PV}" +TWISTED_RELEASE=$(ver_cut 1-2) + +DESCRIPTION="An asynchronous networking framework written in Python" +HOMEPAGE="https://www.twistedmatrix.com/trac/" +SRC_URI="https://twistedmatrix.com/Releases/${TWISTED_PN}" +SRC_URI="${SRC_URI}/${TWISTED_RELEASE}/${TWISTED_P}.tar.bz2 + https://dev.gentoo.org/~mgorny/dist/twisted-regen-cache.gz" + +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~mips ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux" + +LICENSE="MIT" +SLOT="0" +IUSE="conch crypt http2 serial test" +RESTRICT="!test? ( test )" + +RDEPEND=" + >=dev-python/attrs-19.2.0[${PYTHON_USEDEP}] + >=dev-python/automat-0.3.0[${PYTHON_USEDEP}] + >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}] + >=dev-python/hyperlink-17.1.1[${PYTHON_USEDEP}] + >=dev-python/incremental-16.10.1[${PYTHON_USEDEP}] + >=dev-python/pyhamcrest-1.9.0[${PYTHON_USEDEP}] + >=dev-python/zope-interface-4.4.2[${PYTHON_USEDEP}] + conch? ( + dev-python/pyasn1[${PYTHON_USEDEP}] + >=dev-python/cryptography-1.5.0[${PYTHON_USEDEP}] + >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}] + ) + crypt? ( + >=dev-python/pyopenssl-16.0.0[${PYTHON_USEDEP}] + dev-python/service_identity[${PYTHON_USEDEP}] + >=dev-python/idna-0.6[${PYTHON_USEDEP}] + ) + serial? ( >=dev-python/pyserial-3.0[${PYTHON_USEDEP}] ) + http2? ( + >=dev-python/hyper-h2-3.0.0[${PYTHON_USEDEP}] + <dev-python/hyper-h2-4.0.0[${PYTHON_USEDEP}] + >=dev-python/priority-1.1.0[${PYTHON_USEDEP}] + <dev-python/priority-2.0[${PYTHON_USEDEP}] + ) + !dev-python/twisted-core + !dev-python/twisted-conch + !dev-python/twisted-lore + !dev-python/twisted-mail + !dev-python/twisted-names + !dev-python/twisted-news + !dev-python/twisted-pair + !dev-python/twisted-runner + !dev-python/twisted-words + !dev-python/twisted-web +" +DEPEND=" + dev-python/bcrypt + >=dev-python/incremental-16.10.1[${PYTHON_USEDEP}] + test? ( + dev-python/gmpy[${PYTHON_USEDEP}] + dev-python/pyasn1[${PYTHON_USEDEP}] + >=dev-python/cryptography-0.9.1[${PYTHON_USEDEP}] + >=dev-python/appdirs-1.4.0[${PYTHON_USEDEP}] + >=dev-python/pyopenssl-0.13[${PYTHON_USEDEP}] + dev-python/service_identity[${PYTHON_USEDEP}] + dev-python/idna[${PYTHON_USEDEP}] + dev-python/pyserial[${PYTHON_USEDEP}] + >=dev-python/constantly-15.1.0[${PYTHON_USEDEP}] + net-misc/openssh + ) +" + +S=${WORKDIR}/${TWISTED_P} + +python_prepare_all() { + local PATCHES=( + "${FILESDIR}"/twisted-20.3.0-py38-cgi.patch + "${FILESDIR}"/twisted-20.3.0-py38-hmac.patch + ) + + # upstream test for making releases; not very useful and requires + # sphinx (including on py2) + rm src/twisted/python/test/test_release.py || die + + # puts system in EMFILE state, then the exception handler may fail + # trying to open more files due to some gi magic + sed -e '/SKIP_EMFILE/s:None:"Fails on non-pristine systems":' \ + -i src/twisted/internet/test/test_tcp.py || die + + # multicast tests fail within network-sandbox + sed -e 's:test_joinLeave:_&:' \ + -e 's:test_loopback:_&:' \ + -e 's:test_multiListen:_&:' \ + -e 's:test_multicast:_&:' \ + -i src/twisted/test/test_udp.py || die + + # accesses /dev/net/tun + sed -e '/class RealDeviceTestsMixin/a\ + skip = "Requires extra permissions"' \ + -i src/twisted/pair/test/test_tuntap.py || die + + # TODO: figure it out, probably doesn't accept DST date here + sed -e 's:test_getTimezoneOffsetWithoutDaylightSavingTime:_&:' \ + -i src/twisted/test/test_log.py || die + + # TODO: failures specific to Python 2 + sed -e 's:testLookupProcNetTcp:_&:' \ + -i src/twisted/test/test_ident.py || die + sed -e 's:test_loggingFactoryOpensLogfileAutomatically:_&:' \ + -i src/twisted/test/test_policies.py || die + + distutils-r1_python_prepare_all +} + +src_test() { + virtx distutils-r1_src_test +} + +python_test() { + # TODO: upstream seems to override our build paths + distutils_install_for_testing + + "${EPYTHON}" -m twisted.trial twisted || + die "Tests failed with ${EPYTHON}" +} + +python_install() { + distutils-r1_python_install + + cd "${D}$(python_get_sitedir)" || die + + # own the dropin.cache so we don't leave orphans + touch twisted/plugins/dropin.cache || die + + python_doscript "${WORKDIR}"/twisted-regen-cache +} + +python_install_all() { + distutils-r1_python_install_all + + newconfd "${FILESDIR}/twistd.conf" twistd + newinitd "${FILESDIR}/twistd.init" twistd +} + +python_postinst() { + twisted-regen-cache || die +} + +pkg_postinst() { + python_foreach_impl python_postinst + + einfo "Install complete" + if use test ; then + einfo "" + einfo "Some tests have been disabled during testing due to" + einfo "known incompatibilities with the emerge sandboxes and/or" + einfo "not runnable as the root user." + einfo "For a complete test suite run on the code." + einfo "Run the tests as a normal user for each python it is installed to." + einfo " ie: $ python3.6 /usr/bin/trial twisted" + fi +} + +python_postrm() { + rm -f "${ROOT}$(python_get_sitedir)/twisted/plugins/dropin.cache" || die +} + +pkg_postrm() { + # if we're removing the last version, remove the cache file + if [[ ! ${REPLACING_VERSIONS} ]]; then + python_foreach_impl python_postrm + fi +} |