git: 0c9aa1c463d1 - main - net-p2p/py-vertex: Fix build with setuptools 58.0.0+
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 25 Mar 2022 13:45:14 UTC
The branch main has been updated by sunpoet:
URL: https://cgit.FreeBSD.org/ports/commit/?id=0c9aa1c463d15409c73bae04c100990d0ef87ed3
commit 0c9aa1c463d15409c73bae04c100990d0ef87ed3
Author: Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2022-03-25 13:03:21 +0000
Commit: Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2022-03-25 13:37:11 +0000
net-p2p/py-vertex: Fix build with setuptools 58.0.0+
---
net-p2p/py-vertex/Makefile | 5 +-
net-p2p/py-vertex/files/patch-2to3 | 519 +++++++++++++++++++++++++++++++++++++
2 files changed, 522 insertions(+), 2 deletions(-)
diff --git a/net-p2p/py-vertex/Makefile b/net-p2p/py-vertex/Makefile
index 14d9dd9dba05..d9bca832b8b7 100644
--- a/net-p2p/py-vertex/Makefile
+++ b/net-p2p/py-vertex/Makefile
@@ -18,8 +18,9 @@ RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}epsilon>=0:devel/py-epsilon@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}openssl>=0:security/py-openssl@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}twisted>=0:devel/py-twisted@${PY_FLAVOR}
-NO_ARCH= yes
-USE_PYTHON= autoplist concurrent distutils
USES= python:3.6+
+USE_PYTHON= autoplist concurrent distutils
+
+NO_ARCH= yes
.include <bsd.port.mk>
diff --git a/net-p2p/py-vertex/files/patch-2to3 b/net-p2p/py-vertex/files/patch-2to3
new file mode 100644
index 000000000000..6f04ad175c56
--- /dev/null
+++ b/net-p2p/py-vertex/files/patch-2to3
@@ -0,0 +1,519 @@
+--- vertex/gtk2hack.py.orig 2013-08-05 02:42:24 UTC
++++ vertex/gtk2hack.py
+@@ -15,7 +15,7 @@ class _NullCb:
+ self.name = name
+
+ def __call__(self, *a, **kw):
+- print 'No callback provided for', self.name, a, kw
++ print('No callback provided for', self.name, a, kw)
+
+ class _SignalAttacher:
+ def __init__(self, original):
+@@ -100,19 +100,19 @@ class AcceptConnectionDialog:
+
+ def acceptConnectionEvt(self, evt):
+ self.done = True
+- print "YES"
++ print("YES")
+ self.d.callback(1)
+- print "WHAT"
++ print("WHAT")
+ self.window.destroy()
+
+ def rejectConnectionEvt(self, evt):
+- print "DSTRY"
++ print("DSTRY")
+ if not self.done:
+- print "DIE!"
++ print("DIE!")
+ from twisted.python import failure
+ self.d.errback(failure.Failure(KeyError("Connection rejected by user")))
+ else:
+- print "OK"
++ print("OK")
+
+ from twisted.internet.protocol import ServerFactory
+ from twisted.internet.protocol import Protocol
+@@ -120,10 +120,10 @@ from twisted.internet.protocol import Protocol
+ class VertexDemoProtocol(Protocol):
+
+ def connectionMade(self):
+- print 'CONN MADE'
++ print('CONN MADE')
+
+ def dataReceived(self, data):
+- print 'HOLY SHNIKIES', data
++ print('HOLY SHNIKIES', data)
+
+ class VertexFactory(ServerFactory):
+ protocol = VertexDemoProtocol
+@@ -151,7 +151,7 @@ class BuddyItem:
+ self.plug.loadedBuddies[q2qaddress] = self
+
+ def initiateFileTransfer(self, evt):
+- print 'Initiate transfer with ' + self.alias + self.q2qaddress
++ print('Initiate transfer with ' + self.alias + self.q2qaddress)
+
+ def addToMenu(self):
+ self.plug.section.append(self.menuItem)
+@@ -170,7 +170,7 @@ class PlugEntry:
+ self.xml = gtk.glade.XML(GLADE_FILE, "notification_popup")
+
+ def register(self, section):
+- print 'REGISTER'
++ print('REGISTER')
+ self.section = section
+
+ workingdir = FilePath(os.path.expanduser("~/.vertex"))
+@@ -197,11 +197,11 @@ class PlugEntry:
+ self.buildContactMenu()
+
+ def clearContactMenu(self):
+- for bud in self.loadedBuddies.values():
++ for bud in list(self.loadedBuddies.values()):
+ bud.removeFromMenu()
+
+ def buildContactMenu(self):
+- l = self.loadedBuddies.values()
++ l = list(self.loadedBuddies.values())
+ l.sort(key=lambda x: x.alias)
+ l.reverse()
+ for bud in l:
+--- vertex/ptcp.py.orig 2013-08-05 02:42:24 UTC
++++ vertex/ptcp.py
+@@ -17,7 +17,7 @@ from vertex import tcpdfa
+ from vertex.statemachine import StateError
+
+
+-genConnID = itertools.count(8).next
++genConnID = itertools.count(8).__next__
+
+ MAX_PSEUDO_PORT = (2 ** 16)
+
+@@ -818,7 +818,9 @@ class PTCPConnection(tcpdfa.TCP):
+ class PTCPAddress(object):
+ # garbage
+
+- def __init__(self, (host, port), (pseudoHostPort, pseudoPeerPort)):
++ def __init__(self, xxx_todo_changeme, xxx_todo_changeme1):
++ (host, port) = xxx_todo_changeme
++ (pseudoHostPort, pseudoPeerPort) = xxx_todo_changeme1
+ self.host = host
+ self.port = port
+ self.pseudoHostPort = pseudoHostPort
+@@ -945,7 +947,7 @@ class PTCP(protocol.DatagramProtocol):
+ stop notifications, sending hail-mary final FIN packets (which may not
+ reach the other end, but nevertheless can be useful) when possible.
+ """
+- for conn in self._connections.values():
++ for conn in list(self._connections.values()):
+ conn.immediateShutdown()
+ assert not self._connections
+
+@@ -994,11 +996,11 @@ class PTCP(protocol.DatagramProtocol):
+ stb=True,
+ destination=addr))
+ except GarbageDataError:
+- print "garbage data!", pkt
+- except ChecksumMismatchError, cme:
+- print "bad checksum", pkt, cme
+- print repr(pkt.data)
+- print hex(pkt.checksum), hex(pkt.computeChecksum())
++ print("garbage data!", pkt)
++ except ChecksumMismatchError as cme:
++ print("bad checksum", pkt, cme)
++ print(repr(pkt.data))
++ print(hex(pkt.checksum), hex(pkt.computeChecksum()))
+ else:
+ self.packetReceived(pkt)
+
+--- vertex/q2q.py.orig 2015-03-05 04:12:41 UTC
++++ vertex/q2q.py
+@@ -373,7 +373,7 @@ class TCPMethod:
+ def attempt(self, *a):
+ return [self.attemptFactory(self, *a)]
+
+-connectionCounter = itertools.count().next
++connectionCounter = itertools.count().__next__
+ connectionCounter()
+
+ class VirtualConnectionAttempt(AbstractConnectionAttempt):
+@@ -441,7 +441,7 @@ class _PTCPConnectionAttemptPress(AbstractConnectionAt
+ if not self.cancelled:
+ self.q2qproto.service.dispatcher.unbindPort(self.newPort)
+ else:
+- print 'totally wacky, [press] cancelled twice!'
++ print('totally wacky, [press] cancelled twice!')
+ AbstractConnectionAttempt.cancel(self)
+
+ class PTCPMethod(TCPMethod):
+@@ -498,7 +498,7 @@ class RPTCPConnectionAttempt(AbstractConnectionAttempt
+ if not self.cancelled:
+ self.q2qproto.service.dispatcher.unbindPort(self.newPort)
+ else:
+- print 'totally wacky, [rptcp] cancelled twice!'
++ print('totally wacky, [rptcp] cancelled twice!')
+ AbstractConnectionAttempt.cancel(self)
+
+
+@@ -866,7 +866,7 @@ class Q2Q(AMP, subproducer.SuperProducer):
+ log.msg("removing remote listener for %r" % (key,))
+ self.service.listeningClients[key].remove(value)
+ self.listeningClient = []
+- for xport in self.connections.values():
++ for xport in list(self.connections.values()):
+ safely(xport.connectionLost, reason)
+ for observer in self.connectionObservers:
+ safely(observer)
+@@ -1349,7 +1349,7 @@ class Q2Q(AMP, subproducer.SuperProducer):
+
+ subj = certificate_request.getSubject()
+
+- sk = subj.keys()
++ sk = list(subj.keys())
+ if 'commonName' not in sk:
+ raise BadCertificateRequest(
+ "Certificate requested with bad subject: %s" % (sk,))
+@@ -1926,7 +1926,7 @@ class DefaultQ2QAvatar:
+
+ def signCertificateRequest(self, certificateRequest,
+ domainCert, suggestedSerial):
+- keyz = certificateRequest.getSubject().keys()
++ keyz = list(certificateRequest.getSubject().keys())
+ if keyz != ['commonName']:
+ raise BadCertificateRequest(
+ "Don't know how to verify fields other than CN: " +
+@@ -2034,7 +2034,7 @@ class _pemmap(object):
+ def file(self, name, mode):
+ try:
+ return file(os.path.join(self.pathname, name)+'.pem', mode)
+- except IOError, ioe:
++ except IOError as ioe:
+ raise KeyError(name, ioe)
+
+ def __setitem__(self, key, cert):
+@@ -2054,21 +2054,21 @@ class _pemmap(object):
+ yield key, value
+
+ def items(self):
+- return list(self.iteritems())
++ return list(self.items())
+
+ def iterkeys(self):
+- for k, v in self.iteritems():
++ for k, v in self.items():
+ yield k
+
+ def keys(self):
+- return list(self.iterkeys())
++ return list(self.keys())
+
+ def itervalues(self):
+- for k, v in self.iteritems():
++ for k, v in self.items():
+ yield v
+
+ def values(self):
+- return list(self.itervalues())
++ return list(self.values())
+
+
+
+@@ -2149,7 +2149,8 @@ class PTCPConnectionDispatcher(object):
+ self.factory = factory
+ self._ports = {}
+
+- def seedNAT(self, (host, port), sourcePort=0, conditional=True):
++ def seedNAT(self, xxx_todo_changeme, sourcePort=0, conditional=True):
++ (host, port) = xxx_todo_changeme
+ if sourcePort not in self._ports:
+ if sourcePort != 0:
+ if conditional:
+@@ -2183,8 +2184,8 @@ class PTCPConnectionDispatcher(object):
+ return proto.connect(factory, host, port)
+
+ def iterconnections(self):
+- for (p, proto) in self._ports.itervalues():
+- for c in p.protocol._connections.itervalues():
++ for (p, proto) in self._ports.values():
++ for c in p.protocol._connections.values():
+ if c.protocol is not None:
+ yield c.protocol
+ else:
+@@ -2193,8 +2194,8 @@ class PTCPConnectionDispatcher(object):
+
+ def killAllConnections(self):
+ dl = []
+- for p, proto in self._ports.itervalues():
+- for c in p.protocol._connections.itervalues():
++ for p, proto in self._ports.values():
++ for c in p.protocol._connections.values():
+ c._stopRetransmitting()
+ dl.append(defer.maybeDeferred(p.stopListening))
+ self._ports = {}
+@@ -2227,8 +2228,8 @@ class Q2QService(service.MultiService, protocol.Server
+ not. For testing purposes only.
+ """
+ return itertools.chain(
+- self.appConnectionCache.cachedConnections.itervalues(),
+- self.secureConnectionCache.cachedConnections.itervalues(),
++ iter(self.appConnectionCache.cachedConnections.values()),
++ iter(self.secureConnectionCache.cachedConnections.values()),
+ iter(self.subConnections),
+ (self.dispatcher or ()) and self.dispatcher.iterconnections())
+
+@@ -2328,7 +2329,7 @@ class Q2QService(service.MultiService, protocol.Server
+ def _secured(proto):
+ lfm = self.localFactoriesMapping
+ def startup(listenResult):
+- for protocol, factory in protocolsToFactories.iteritems():
++ for protocol, factory in protocolsToFactories.items():
+ key = (fromAddress, protocol)
+ if key not in lfm:
+ lfm[key] = []
+@@ -2336,7 +2337,7 @@ class Q2QService(service.MultiService, protocol.Server
+ factory.doStart()
+
+ def shutdown():
+- for protocol, factory in protocolsToFactories.iteritems():
++ for protocol, factory in protocolsToFactories.items():
+ lfm[fromAddress, protocol].remove(
+ (factory, serverDescription))
+ factory.doStop()
+@@ -2353,7 +2354,7 @@ class Q2QService(service.MultiService, protocol.Server
+
+ def _gotPubUDPPort(publicAddress):
+ self._publicUDPAddress = publicAddress
+- return proto.listen(fromAddress, protocolsToFactories.keys(),
++ return proto.listen(fromAddress, list(protocolsToFactories.keys()),
+ serverDescription).addCallback(startup)
+ pubUDPDeferred.addCallback(_gotPubUDPPort)
+ return pubUDPDeferred
+@@ -2501,7 +2502,7 @@ class Q2QService(service.MultiService, protocol.Server
+
+ def stopService(self):
+ dl = []
+- for cwait, delayed in self.inboundConnections.itervalues():
++ for cwait, delayed in self.inboundConnections.values():
+ delayed.cancel()
+ self.inboundConnections.clear()
+ if self.q2qPort is not None:
+--- vertex/q2qclient.py.orig 2015-03-05 02:53:34 UTC
++++ vertex/q2qclient.py
+@@ -24,7 +24,7 @@ class Q2QAuthorize(Options):
+ self.password = password
+
+ def reportNoCertificate(self, error):
+- print "No certificate retrieved:", error.getErrorMessage(), "(see ~/.q2q-client-log for details)"
++ print("No certificate retrieved:", error.getErrorMessage(), "(see ~/.q2q-client-log for details)")
+ log.err(error)
+ return None
+
+@@ -115,7 +115,7 @@ class FileSender(protocol.Protocol):
+ self.transport.loseConnection()
+
+ def dataReceived(self, data):
+- print "WTF THE CLIENT IS GETTING DATA", repr(data)
++ print("WTF THE CLIENT IS GETTING DATA", repr(data))
+
+ def registerProducer(self, producer, streaming):
+ self.transport.registerProducer(producer, streaming)
+@@ -166,9 +166,9 @@ class ClientQ2QService(q2q.Q2QService):
+ *a, **kw)
+
+ def getDefaultFrom(self, default=None):
+- i = self.certificateStorage.localStore.iterkeys()
++ i = iter(self.certificateStorage.localStore.keys())
+ try:
+- return i.next()
++ return next(i)
+ except StopIteration:
+ return default
+
+@@ -244,7 +244,7 @@ class Q2QReceive(Options):
+ def pr(x):
+ return x
+ def stopit(err):
+- print "Couldn't Register for File Transfer:", err.getErrorMessage()
++ print("Couldn't Register for File Transfer:", err.getErrorMessage())
+ log.err(err)
+ reactor.stop()
+ serv.listenQ2Q(self.parent.getFrom(),
+@@ -276,13 +276,13 @@ class TextNexusUI(sigma.BaseNexusUI):
+ self.call.start(5)
+
+ def report(self):
+- print 'Transloads:', len(self.transloads)
++ print('Transloads:', len(self.transloads))
+ for transloadui in self.transloads:
+- print '---', transloadui.name, '---'
+- print transloadui.bits.percent()
+- for peer, mask in transloadui.masks.items():
+- print peer, mask.percent()
+- print 'end report'
++ print('---', transloadui.name, '---')
++ print(transloadui.bits.percent())
++ for peer, mask in list(transloadui.masks.items()):
++ print(peer, mask.percent())
++ print('end report')
+
+ class Q2QSigma(Options):
+
+@@ -346,7 +346,7 @@ class Q2QRegister(Options):
+ svc = self.parent.getService()
+
+ def showit(x):
+- print "%s: %s" % (x.value.__class__, x.getErrorMessage())
++ print("%s: %s" % (x.value.__class__, x.getErrorMessage()))
+
+ enregister(svc, newAddress, self.password).addErrback(
+ showit).addBoth(lambda nothing: reactor.stop())
+--- vertex/q2qstandalone.py.orig 2015-03-05 02:53:34 UTC
++++ vertex/q2qstandalone.py
+@@ -41,7 +41,8 @@ class _usermap:
+ def __init__(self, path):
+ self.path = path
+
+- def __setitem__(self, (domain, username), password):
++ def __setitem__(self, xxx_todo_changeme, password):
++ (domain, username) = xxx_todo_changeme
+ domainpath = os.path.join(self.path, domain)
+ if not os.path.exists(domainpath):
+ os.makedirs(domainpath)
+@@ -53,7 +54,8 @@ class _usermap:
+ password=password.encode('hex')).serialize())
+ f.close()
+
+- def get(self, (domain, username)):
++ def get(self, xxx_todo_changeme1):
++ (domain, username) = xxx_todo_changeme1
+ domainpath = os.path.join(self.path, domain)
+ if os.path.exists(domainpath):
+ filepath = os.path.join(domainpath, username+".info")
+@@ -70,7 +72,7 @@ class DirectoryCertificateAndUserStore(q2q.DirectoryCe
+ try:
+ return q2q.DirectoryCertificateStore.getPrivateCertificate(self, domain)
+ except KeyError:
+- if len(self.localStore.keys()) > 10:
++ if len(list(self.localStore.keys())) > 10:
+ # avoid DoS; nobody is going to need autocreated certs for more
+ # than 10 domains
+ raise
+--- vertex/test/helpers.py.orig 2015-03-05 02:53:34 UTC
++++ vertex/test/helpers.py
+@@ -63,17 +63,17 @@ class FakeQ2QService:
+ if pump.flush(debug):
+ result = True
+ if debug:
+- print 'iteration finished. continuing?', result
++ print('iteration finished. continuing?', result)
+ c = self.calls
+ self.calls = []
+ for s, f, a, k in c:
+ if debug:
+- print 'timed event', s, f, a, k
++ print('timed event', s, f, a, k)
+ f(*a,**k)
+ return result
+
+ def listenQ2Q(self, fromAddress, protocolsToFactories, serverDescription):
+- for pname, pfact in protocolsToFactories.items():
++ for pname, pfact in list(protocolsToFactories.items()):
+ self.listeners[fromAddress, pname] = pfact, serverDescription
+ return defer.succeed(None)
+
+@@ -90,7 +90,7 @@ class FakeQ2QService:
+
+ listener, description = self.listeners.get((toAddress, protocolName))
+ if listener is None:
+- print 'void listener', fromAddress, toAddress, self.listeners, self.listener
++ print('void listener', fromAddress, toAddress, self.listeners, self.listener)
+ reason = Failure(KeyError())
+ protocolFactory.clientConnectionFailed(None, reason)
+ return defer.fail(reason)
+--- vertex/test/test_dependencyservice.py.orig 2013-08-05 02:42:24 UTC
++++ vertex/test/test_dependencyservice.py
+@@ -35,10 +35,10 @@ class TestDependencyService(unittest.TestCase):
+ args = dict(one={}, two={}, three={})
+
+ one = One(**args)
+- self.assert_(one.initialized == ['ONE', 'THREE', 'TWO'])
++ self.assertTrue(one.initialized == ['ONE', 'THREE', 'TWO'])
+
+ two = Two(**args)
+- self.assert_(two.initialized == ['ONE', 'TWO', 'THREE'])
++ self.assertTrue(two.initialized == ['ONE', 'TWO', 'THREE'])
+
+
+ def test_circularDepends(self):
+@@ -52,7 +52,7 @@ class TestDependencyService(unittest.TestCase):
+ except depserv.StartupError:
+ pass
+ else:
+- raise unittest.FailTest, 'circular dependencies did not raise an error'
++ raise unittest.FailTest('circular dependencies did not raise an error')
+
+
+ def test_requiredWithDependency(self):
+@@ -66,4 +66,4 @@ class TestDependencyService(unittest.TestCase):
+ except depserv.StartupError:
+ pass
+ else:
+- raise unittest.FailTest, 'unsatisfied dependencies did not raise an error'
++ raise unittest.FailTest('unsatisfied dependencies did not raise an error')
+--- vertex/test/test_ptcp.py.orig 2015-03-05 04:12:41 UTC
++++ vertex/test/test_ptcp.py
+@@ -48,8 +48,8 @@ class TestProtocol(protocol.Protocol):
+ bytes = ''.join(self.buffer)
+ if not self._waiting[1].startswith(bytes):
+ x = len(os.path.commonprefix([bytes, self._waiting[1]]))
+- print x
+- print 'it goes wrong starting with', repr(bytes[x:x+100]), repr(self._waiting[1][x:x+100])
++ print(x)
++ print('it goes wrong starting with', repr(bytes[x:x+100]), repr(self._waiting[1][x:x+100]))
+ if bytes == self._waiting[1]:
+ self._waiting[0].callback(None)
+ self._waiting = None
+@@ -167,11 +167,11 @@ class PTCPTransportTestCase(ConnectedPTCPMixin, unitte
+
+ def gotAddress(results):
+ (serverSuccess, serverAddress), (clientSuccess, clientAddress) = results
+- self.failUnless(serverSuccess)
+- self.failUnless(clientSuccess)
++ self.assertTrue(serverSuccess)
++ self.assertTrue(clientSuccess)
+
+- self.assertEquals(serverAddress[1], serverPort.getHost().port)
+- self.assertEquals(clientAddress[1], clientPort.getHost().port)
++ self.assertEqual(serverAddress[1], serverPort.getHost().port)
++ self.assertEqual(clientAddress[1], clientPort.getHost().port)
+
+ def connectionsMade(ignored):
+ return defer.DeferredList([serverProto.transport.whoami(), clientProto.transport.whoami()]).addCallback(gotAddress)
+@@ -228,7 +228,7 @@ class PTCPTransportTestCase(ConnectedPTCPMixin, unitte
+ ServerProtocol=TestProducerProtocol)
+
+ def disconnected(ignored):
+- self.assertEquals(
++ self.assertEqual(
+ ''.join(clientProto.buffer),
+ ''.join([chr(n) * serverProto.WRITE_SIZE
+ for n in range(serverProto.NUM_WRITES)]))
+@@ -249,7 +249,7 @@ class PTCPTransportTestCase(ConnectedPTCPMixin, unitte
+ clientProto.transport.resumeProducing()
+
+ def cbBytes(ignored):
+- self.failUnless(resumed)
++ self.assertTrue(resumed)
+ clientProto.transport.loseConnection()
+
+ def cbConnect(ignored):
+@@ -282,7 +282,7 @@ class PTCPTransportTestCase(ConnectedPTCPMixin, unitte
+
+ def cbBytes(ignored):
+ # print 'Disconnected'
+- self.assertEquals(
++ self.assertEqual(
+ ''.join(clientProto.buffer),
+ ''.join([chr(n) * serverProto.WRITE_SIZE
+ for n in range(serverProto.NUM_WRITES)]))