Commit 889fde3b authored by Julien Muchembled's avatar Julien Muchembled

Drop support for Python 2.6

Commit 40d4e496 is not reverted
because Python 3 will also require to keep the distinction between
blob and text.
parent c8b11bf3
......@@ -52,7 +52,7 @@ easily scalable to tens of thousand of nodes.
Requirements
============
- Python 2.6 or 2.7
- Python 2.7
- OpenSSL binary and development libraries
- OpenVPN >= 2.4
- Babel_ (with Nexedi patches)
......
......@@ -166,7 +166,7 @@ def main():
config.disable_proto = ()
if config.default:
# Make sure we won't tunnel over re6st.
config.disable_proto = tuple(set(('tcp6', 'udp6')).union(
config.disable_proto = tuple({'tcp6', 'udp6'}.union(
config.disable_proto))
address = []
server_tunnels = {}
......
......@@ -262,7 +262,7 @@ class Babel(object):
def handle_dump(self, interfaces, neighbours, xroutes, routes):
# neighbours = {neigh_prefix: (neighbour, {dst_prefix: route})}
n = dict(((n.address, n.ifindex), (n, {})) for n in neighbours)
n = {(n.address, n.ifindex): (n, {}) for n in neighbours}
unidentified = set(n)
self.neighbours = neighbours = {}
a = len(self.network)
......@@ -307,7 +307,7 @@ class Babel(object):
neighbours[None] = None, routes
logging.trace("Routes via unidentified neighbours. %r",
neighbours)
self.interfaces = dict((i.index, name) for i, name in interfaces)
self.interfaces = {i.index: name for i, name in interfaces}
self.handler.babel_dump()
def handle_set_cost_multiplier(self, flags):
......
......@@ -213,8 +213,7 @@ class RegistryServer(object):
not_after = None
old = time.time() - GRACE_PERIOD
q = self.db.execute
with self.lock:
with self.db:
with self.lock, self.db:
q("BEGIN")
for token, x in q("SELECT token, date FROM token"):
if x <= old:
......@@ -539,8 +538,7 @@ class RegistryServer(object):
@rpc_private
def revoke(self, cn_or_serial):
with self.lock:
with self.db:
with self.lock, self.db:
q = self.db.execute
try:
serial = int(cn_or_serial)
......@@ -570,8 +568,7 @@ class RegistryServer(object):
@rpc_private
def updateHMAC(self):
with self.lock:
with self.db:
with self.lock, self.db:
hmac = [self.getConfig(BABEL_HMAC[i], None) for i in (0,1,2)]
if hmac[0]:
if hmac[1]:
......@@ -595,8 +592,7 @@ class RegistryServer(object):
@rpc_private
def getNodePrefix(self, email):
with self.lock:
with self.db:
with self.lock, self.db:
try:
cert, = self.db.execute("SELECT cert FROM cert WHERE email = ?",
(email,)).next()
......@@ -636,10 +632,10 @@ class RegistryServer(object):
def versions(self):
with self.peers_lock:
self.request_dump()
peers = set(prefix
peers = {prefix
for neigh_routes in self.ctl.neighbours.itervalues()
for prefix in neigh_routes[1]
if prefix)
if prefix}
peers.add(self.prefix)
peer_dict = {}
s = self.sock,
......@@ -686,7 +682,7 @@ class RegistryServer(object):
self.sendto(utils.binFromSubnet(peers.popleft()), 5)
elif not r:
break
return json.dumps(dict((k, list(v)) for k, v in graph.iteritems()))
return json.dumps({k: list(v) for k, v in graph.iteritems()})
class RegistryClient(object):
......
......@@ -239,9 +239,9 @@ class BaseTunnelManager(object):
elif cache.same_country:
sys.exit("Can not respect 'same_country' network configuration"
" (GEOIP2_MMDB not set)")
self._address = dict((family, utils.dump_address(address))
self._address = {family: utils.dump_address(address)
for family, address in address_dict.iteritems()
if address)
if address}
self.sock = socket.socket(socket.AF_INET6,
socket.SOCK_DGRAM | socket.SOCK_CLOEXEC)
......@@ -903,10 +903,10 @@ class TunnelManager(BaseTunnelManager):
logging.debug('Analyze routes ...')
neighbours = self.ctl.neighbours
# Collect all nodes known by Babel
peers = set(prefix
peers = {prefix
for neigh_routes in neighbours.itervalues()
for prefix in neigh_routes[1]
if prefix)
if prefix}
# Keep only distant peers.
distant_peers[:] = peers.difference(neighbours)
distant_peers.sort(key=self._newTunnelScore)
......
......@@ -51,7 +51,6 @@ Environment :: Console
License :: OSI Approved :: GNU General Public License (GPL)
Natural Language :: English
Operating System :: POSIX :: Linux
Programming Language :: Python :: 2.6
Programming Language :: Python :: 2.7
Topic :: Internet
Topic :: System :: Networking
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment