Avoid .format, since it is inconsistent between Python 2.6 and 2.7 (and the rest of Tahoe-LAFS doesn't use it).
Signed-off-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
ac8ba601ba
commit
c89ac63323
|
@ -325,7 +325,7 @@ class Uploader(QueueMixin):
|
||||||
elif self._db.is_new_file(pathinfo, relpath_u):
|
elif self._db.is_new_file(pathinfo, relpath_u):
|
||||||
new_version = current_version + 1
|
new_version = current_version + 1
|
||||||
else:
|
else:
|
||||||
self._log("Not uploading '{0}'".format(relpath_u))
|
self._log("Not uploading %r" % (relpath_u,))
|
||||||
self._count('objects_not_uploaded')
|
self._count('objects_not_uploaded')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ class Uploader(QueueMixin):
|
||||||
elif self._db.is_new_file(pathinfo, relpath_u):
|
elif self._db.is_new_file(pathinfo, relpath_u):
|
||||||
new_version = current_version + 1
|
new_version = current_version + 1
|
||||||
else:
|
else:
|
||||||
self._log("Not uploading '{0}'".format(relpath_u))
|
self._log("Not uploading %r" % (relpath_u,))
|
||||||
self._count('objects_not_uploaded')
|
self._count('objects_not_uploaded')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -628,7 +628,7 @@ class Downloader(QueueMixin, WriteFileMixin):
|
||||||
if self._should_download(relpath_u, metadata['version']):
|
if self._should_download(relpath_u, metadata['version']):
|
||||||
extension += [(relpath_u, file_node, metadata)]
|
extension += [(relpath_u, file_node, metadata)]
|
||||||
else:
|
else:
|
||||||
self._log("Excluding '{0}'".format(relpath_u))
|
self._log("Excluding %r" % (relpath_u,))
|
||||||
self._count('objects_excluded')
|
self._count('objects_excluded')
|
||||||
self._call_hook(None, 'processed')
|
self._call_hook(None, 'processed')
|
||||||
return extension
|
return extension
|
||||||
|
|
|
@ -48,7 +48,7 @@ if not exists(data_base):
|
||||||
mkdir(data_base)
|
mkdir(data_base)
|
||||||
|
|
||||||
if not exists(tahoe_bin):
|
if not exists(tahoe_bin):
|
||||||
raise RuntimeError("Can't find 'tahoe' binary at '{}'".format(tahoe_bin))
|
raise RuntimeError("Can't find 'tahoe' binary at %r" % (tahoe_bin,))
|
||||||
|
|
||||||
if 'kill' in sys.argv:
|
if 'kill' in sys.argv:
|
||||||
print("Killing the grid")
|
print("Killing the grid")
|
||||||
|
@ -92,7 +92,7 @@ for x in range(5):
|
||||||
subprocess.check_call(
|
subprocess.check_call(
|
||||||
[
|
[
|
||||||
tahoe_bin, 'create-node',
|
tahoe_bin, 'create-node',
|
||||||
'--nickname', 'node{}'.format(x),
|
'--nickname', 'node%d' % (x,),
|
||||||
'--introducer', furl,
|
'--introducer', furl,
|
||||||
data_dir,
|
data_dir,
|
||||||
]
|
]
|
||||||
|
@ -100,18 +100,18 @@ for x in range(5):
|
||||||
with open(join(data_dir, 'tahoe.cfg'), 'w') as f:
|
with open(join(data_dir, 'tahoe.cfg'), 'w') as f:
|
||||||
f.write('''
|
f.write('''
|
||||||
[node]
|
[node]
|
||||||
nickname = node{node_id}
|
nickname = node%(node_id)s
|
||||||
web.port =
|
web.port =
|
||||||
web.static = public_html
|
web.static = public_html
|
||||||
tub.location = localhost:{tub_port}
|
tub.location = localhost:%(tub_port)d
|
||||||
|
|
||||||
[client]
|
[client]
|
||||||
# Which services should this client connect to?
|
# Which services should this client connect to?
|
||||||
introducer.furl = {furl}
|
introducer.furl = %(furl)s
|
||||||
shares.needed = 2
|
shares.needed = 2
|
||||||
shares.happy = 3
|
shares.happy = 3
|
||||||
shares.total = 4
|
shares.total = 4
|
||||||
'''.format(node_id=x, furl=furl, tub_port=(9900 + x)))
|
''' % {'node_id':x, 'furl':furl, 'tub_port':(9900 + x)})
|
||||||
subprocess.check_call(
|
subprocess.check_call(
|
||||||
[
|
[
|
||||||
tahoe_bin, 'start', data_dir,
|
tahoe_bin, 'start', data_dir,
|
||||||
|
@ -125,7 +125,7 @@ do_invites = False
|
||||||
node_id = 0
|
node_id = 0
|
||||||
for name in ['alice', 'bob']:
|
for name in ['alice', 'bob']:
|
||||||
data_dir = join(data_base, name)
|
data_dir = join(data_base, name)
|
||||||
magic_dir = join(data_base, '{}-magic'.format(name))
|
magic_dir = join(data_base, '%s-magic' % (name,))
|
||||||
mkdir(magic_dir)
|
mkdir(magic_dir)
|
||||||
if not exists(data_dir):
|
if not exists(data_dir):
|
||||||
do_invites = True
|
do_invites = True
|
||||||
|
@ -141,17 +141,17 @@ for name in ['alice', 'bob']:
|
||||||
with open(join(data_dir, 'tahoe.cfg'), 'w') as f:
|
with open(join(data_dir, 'tahoe.cfg'), 'w') as f:
|
||||||
f.write('''
|
f.write('''
|
||||||
[node]
|
[node]
|
||||||
nickname = {name}
|
nickname = %(name)s
|
||||||
web.port = tcp:998{node_id}:interface=localhost
|
web.port = tcp:998%(node_id)d:interface=localhost
|
||||||
web.static = public_html
|
web.static = public_html
|
||||||
|
|
||||||
[client]
|
[client]
|
||||||
# Which services should this client connect to?
|
# Which services should this client connect to?
|
||||||
introducer.furl = {furl}
|
introducer.furl = %(furl)s
|
||||||
shares.needed = 2
|
shares.needed = 2
|
||||||
shares.happy = 3
|
shares.happy = 3
|
||||||
shares.total = 4
|
shares.total = 4
|
||||||
'''.format(name=name, node_id=node_id, furl=furl, magic_dir=magic_dir))
|
''' % {'name':name, 'node_id':node_id, 'furl':furl})
|
||||||
subprocess.check_call(
|
subprocess.check_call(
|
||||||
[
|
[
|
||||||
tahoe_bin, 'start', data_dir,
|
tahoe_bin, 'start', data_dir,
|
||||||
|
@ -206,7 +206,7 @@ if do_invites:
|
||||||
if True:
|
if True:
|
||||||
for name in ['alice', 'bob']:
|
for name in ['alice', 'bob']:
|
||||||
with open(join(data_base, name, 'private', 'magic_folder_dircap'), 'r') as f:
|
with open(join(data_base, name, 'private', 'magic_folder_dircap'), 'r') as f:
|
||||||
print("dircap {}: {}".format(name, f.read().strip()))
|
print("dircap %s: %s" % (name, f.read().strip()))
|
||||||
|
|
||||||
# give storage nodes a chance to connect properly? I'm not entirely
|
# give storage nodes a chance to connect properly? I'm not entirely
|
||||||
# sure what's up here, but I get "UnrecoverableFileError" on the
|
# sure what's up here, but I get "UnrecoverableFileError" on the
|
||||||
|
@ -354,7 +354,7 @@ if True:
|
||||||
print(" file contents still mismatched: %d bytes:\n" % (len(content),))
|
print(" file contents still mismatched: %d bytes:\n" % (len(content),))
|
||||||
print(content)
|
print(content)
|
||||||
else:
|
else:
|
||||||
print(" {} not there yet".format(alice_foo))
|
print(" %r not there yet" % (alice_foo,))
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
# XXX test .backup (delete a file)
|
# XXX test .backup (delete a file)
|
||||||
|
|
|
@ -270,7 +270,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
|
||||||
|
|
||||||
# ensure we still have a DB entry, and that the version is 1
|
# ensure we still have a DB entry, and that the version is 1
|
||||||
node, metadata = yield self.magicfolder.downloader._get_collective_latest_file(u'foo')
|
node, metadata = yield self.magicfolder.downloader._get_collective_latest_file(u'foo')
|
||||||
self.assertTrue(node is not None, "Failed to find '{}' in DMD".format(path))
|
self.assertTrue(node is not None, "Failed to find %r in DMD" % (path,))
|
||||||
self.failUnlessEqual(metadata['version'], 1)
|
self.failUnlessEqual(metadata['version'], 1)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
|
@ -305,7 +305,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
|
||||||
|
|
||||||
# ensure we still have a DB entry, and that the version is 1
|
# ensure we still have a DB entry, and that the version is 1
|
||||||
node, metadata = yield self.magicfolder.downloader._get_collective_latest_file(u'foo')
|
node, metadata = yield self.magicfolder.downloader._get_collective_latest_file(u'foo')
|
||||||
self.assertTrue(node is not None, "Failed to find '{}' in DMD".format(path))
|
self.assertTrue(node is not None, "Failed to find %r in DMD" % (path,))
|
||||||
self.failUnlessEqual(metadata['version'], 1)
|
self.failUnlessEqual(metadata['version'], 1)
|
||||||
|
|
||||||
# restore the file, with different contents
|
# restore the file, with different contents
|
||||||
|
@ -318,7 +318,7 @@ class MagicFolderTestMixin(MagicFolderCLITestMixin, ShouldFailMixin, ReallyEqual
|
||||||
|
|
||||||
# ensure we still have a DB entry, and that the version is 2
|
# ensure we still have a DB entry, and that the version is 2
|
||||||
node, metadata = yield self.magicfolder.downloader._get_collective_latest_file(u'foo')
|
node, metadata = yield self.magicfolder.downloader._get_collective_latest_file(u'foo')
|
||||||
self.assertTrue(node is not None, "Failed to find '{}' in DMD".format(path))
|
self.assertTrue(node is not None, "Failed to find %r in DMD" % (path,))
|
||||||
self.failUnlessEqual(metadata['version'], 2)
|
self.failUnlessEqual(metadata['version'], 2)
|
||||||
|
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Reference in New Issue