aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPo-Chuan Hsieh <sunpoet@FreeBSD.org>2022-03-25 13:33:59 +0000
committerPo-Chuan Hsieh <sunpoet@FreeBSD.org>2022-03-25 13:38:20 +0000
commit7aa9570e2be2591eac6ab8306a85f5e38be95601 (patch)
tree264a4e3073a45fb099017cd696dabf29e3e39c39
parente4b417e3be07475addc65bd4981ded03a730cdbb (diff)
downloadports-7aa9570e2be2591eac6ab8306a85f5e38be95601.tar.gz
ports-7aa9570e2be2591eac6ab8306a85f5e38be95601.zip
security/py-gnutls: Fix build with setuptools 58.0.0+
With hat: python
-rw-r--r--security/py-gnutls/files/patch-2to3201
1 files changed, 201 insertions, 0 deletions
diff --git a/security/py-gnutls/files/patch-2to3 b/security/py-gnutls/files/patch-2to3
new file mode 100644
index 000000000000..ab5564904aee
--- /dev/null
+++ b/security/py-gnutls/files/patch-2to3
@@ -0,0 +1,201 @@
+--- gnutls/connection.py.orig 2017-01-26 09:15:54 UTC
++++ gnutls/connection.py
+@@ -388,7 +388,7 @@ class ServerSession(Session):
+ data_length = c_size_t(256)
+ data = create_string_buffer(data_length.value)
+ hostname_type = c_uint()
+- for i in xrange(2**16):
++ for i in range(2**16):
+ try:
+ gnutls_server_name_get(self._c_object, data, byref(data_length), byref(hostname_type), i)
+ except RequestedDataNotAvailable:
+@@ -407,7 +407,7 @@ class ServerSessionFactory(object):
+
+ def __init__(self, socket, context, session_class=ServerSession):
+ if not issubclass(session_class, ServerSession):
+- raise TypeError, "session_class must be a subclass of ServerSession"
++ raise TypeError("session_class must be a subclass of ServerSession")
+ self.socket = socket
+ self.context = context
+ self.session_class = session_class
+--- gnutls/constants.py.orig 2016-03-08 13:28:28 UTC
++++ gnutls/constants.py
+@@ -31,7 +31,7 @@ class GNUTLSConstant(int):
+
+ ## Generate all exported constants
+ code = '\n'.join(["%s = GNUTLSConstant('%s')" % (name, name) for name in __all__])
+-exec code in locals(), globals()
++exec(code, locals(), globals())
+ del code, name
+
+ del constants
+--- gnutls/interfaces/twisted/__init__.py.orig 2016-03-08 13:28:28 UTC
++++ gnutls/interfaces/twisted/__init__.py
+@@ -41,7 +41,7 @@ class RecurrentCall(object):
+ self.now, self.next = self.next, self.next + self.period
+ result = self.func(*self.args, **self.kwargs)
+ if result is KeepRunning:
+- delay = max(self.next-time(), 0)
++ delay = max(self.__next__-time(), 0)
+ self.callid = reactor.callLater(delay, self)
+ def cancel(self):
+ if self.callid is not None:
+@@ -77,7 +77,7 @@ class TLSMixin:
+ return tcp.Connection.doRead(self)
+ except (OperationWouldBlock, OperationInterrupted):
+ return
+- except GNUTLSError, e:
++ except GNUTLSError as e:
+ return e
+
+ def writeSomeData(self, data):
+@@ -87,7 +87,7 @@ class TLSMixin:
+ return self.writeSomeData(data)
+ except OperationWouldBlock:
+ return 0
+- except GNUTLSError, e:
++ except GNUTLSError as e:
+ return e
+
+ def _sendCloseReason(self, reason):
+@@ -117,11 +117,11 @@ class TLSMixin:
+ self.stopWriting()
+ try:
+ self._sendCloseAlert(SHUT_WR)
+- except OperationWouldBlock, e:
++ except OperationWouldBlock as e:
+ if self.socket.interrupted_while_writing:
+ self.startWriting()
+ return
+- except Exception, e:
++ except Exception as e:
+ return e
+ del self.doWrite
+
+@@ -153,7 +153,7 @@ class TLSClient(TLSMixin, tcp.Client):
+ return
+ try:
+ self.context.credentials.verify_callback(self.socket.peer_certificate)
+- except Exception, e:
++ except Exception as e:
+ self.loseConnection(e)
+ return
+ else:
+@@ -166,7 +166,7 @@ class TLSClient(TLSMixin, tcp.Client):
+ return
+ try:
+ session.verify_peer()
+- except Exception, e:
++ except Exception as e:
+ preverify_status = e
+ else:
+ preverify_status = CertificateOK
+@@ -184,7 +184,7 @@ class TLSClient(TLSMixin, tcp.Client):
+ if self.socket.interrupted_while_writing:
+ self.startWriting()
+ return
+- except GNUTLSError, e:
++ except GNUTLSError as e:
+ del self.doRead
+ self.failIfNotConnected(err = e)
+ return
+@@ -195,11 +195,11 @@ class TLSClient(TLSMixin, tcp.Client):
+
+ try:
+ self._verifyPeer()
+- except GNUTLSError, e:
++ except GNUTLSError as e:
+ self.closeTLSSession(e)
+ self.failIfNotConnected(err = e)
+ return
+- except Exception, e:
++ except Exception as e:
+ self.closeTLSSession(e)
+ self.failIfNotConnected(err = error.getConnectError(str(e)))
+ return
+@@ -258,7 +258,7 @@ class TLSServer(TLSMixin, tcp.Server):
+ return
+ try:
+ self.context.credentials.verify_callback(self.socket.peer_certificate)
+- except Exception, e:
++ except Exception as e:
+ self.loseConnection(e)
+ return
+ else:
+@@ -271,7 +271,7 @@ class TLSServer(TLSMixin, tcp.Server):
+ return
+ try:
+ session.verify_peer()
+- except Exception, e:
++ except Exception as e:
+ preverify_status = e
+ else:
+ preverify_status = CertificateOK
+@@ -289,7 +289,7 @@ class TLSServer(TLSMixin, tcp.Server):
+ if self.socket.interrupted_while_writing:
+ self.startWriting()
+ return
+- except GNUTLSError, e:
++ except GNUTLSError as e:
+ del self.doRead
+ return e
+
+@@ -300,7 +300,7 @@ class TLSServer(TLSMixin, tcp.Server):
+
+ try:
+ self._verifyPeer()
+- except Exception, e:
++ except Exception as e:
+ self.loseConnection(e)
+ return
+
+--- gnutls/validators.py.orig 2016-03-08 13:28:28 UTC
++++ gnutls/validators.py
+@@ -76,7 +76,7 @@ class TypeValidator(Validator):
+ class MultiTypeValidator(TypeValidator):
+ @staticmethod
+ def can_validate(obj):
+- return isinstance(obj, tuple) and not filter(lambda x: not isclass(x), obj)
++ return isinstance(obj, tuple) and not [x for x in obj if not isclass(x)]
+
+ class OneOfValidator(Validator):
+ def __init__(self, typ):
+@@ -94,7 +94,7 @@ class ListOfValidator(Validator):
+ def __init__(self, typ):
+ self.type = typ.type
+ def check(self, value):
+- return isinstance(value, (tuple, list)) and not filter(lambda x: not isinstance(x, self.type), value)
++ return isinstance(value, (tuple, list)) and not [x for x in value if not isinstance(x, self.type)]
+ @staticmethod
+ def can_validate(obj):
+ return isinstance(obj, list_of)
+@@ -109,7 +109,7 @@ class ComplexValidator(Validator):
+ return bool(sum(t.check(value) for t in self.type))
+ @staticmethod
+ def can_validate(obj):
+- return isinstance(obj, tuple) and not filter(lambda x: Validator.get(x) is None, obj)
++ return isinstance(obj, tuple) and not [x for x in obj if Validator.get(x) is None]
+ @property
+ def name(self):
+ return self.join_names([x.name for x in self.type])
+@@ -135,7 +135,7 @@ class one_of(object):
+
+ class list_of(object):
+ def __init__(self, *args):
+- if filter(lambda x: not isclass(x), args):
++ if [x for x in args if not isclass(x)]:
+ raise TypeError("list_of arguments must be types")
+ if len(args) == 1:
+ self.type = args[0]
+@@ -163,9 +163,9 @@ def preserve_signature(func):
+ if constants:
+ ## import the required GNUTLSConstants used as function default arguments
+ code = "from gnutls.constants import %s\n" % ', '.join(c.name for c in constants)
+- exec code in locals(), locals()
++ exec(code, locals(), locals())
+ code = "def %s(%s): return wrapper(%s)\nnew_wrapper = %s\n" % (func.__name__, signature, parameters, func.__name__)
+- exec code in locals(), locals()
++ exec(code, locals(), locals())
+ new_wrapper.__name__ = func.__name__
+ new_wrapper.__doc__ = func.__doc__
+ new_wrapper.__module__ = func.__module__