From: Daira Hopwood Date: Fri, 23 Oct 2015 21:02:09 +0000 (+0100) Subject: Fix some path Unixisms. X-Git-Url: https://git.rkrishnan.org/?a=commitdiff_plain;h=286b05658aae4ed25621c1c299a3240696fe51dc;p=tahoe-lafs%2Ftahoe-lafs.git Fix some path Unixisms. Signed-off-by: Daira Hopwood --- diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index 9225d17b..ea508119 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -182,9 +182,11 @@ class Uploader(QueueMixin): # TODO: allow a path rather than a cap URI. self._upload_dirnode = self._client.create_node_from_uri(upload_dircap) if not IDirectoryNode.providedBy(self._upload_dirnode): - raise AssertionError("The URI in 'private/magic_folder_dircap' does not refer to a directory.") + raise AssertionError("The URI in '%s' does not refer to a directory." + % os.path.join('private', 'magic_folder_dircap')) if self._upload_dirnode.is_unknown() or self._upload_dirnode.is_readonly(): - raise AssertionError("The URI in 'private/magic_folder_dircap' is not a writecap to a directory.") + raise AssertionError("The URI in '%s' is not a writecap to a directory." + % os.path.join('private', 'magic_folder_dircap')) self._inotify = get_inotify_module() self._notifier = self._inotify.INotify() @@ -482,9 +484,11 @@ class Downloader(QueueMixin, WriteFileMixin): self._collective_dirnode = self._client.create_node_from_uri(collective_dircap) if not IDirectoryNode.providedBy(self._collective_dirnode): - raise AssertionError("The URI in 'private/collective_dircap' does not refer to a directory.") + raise AssertionError("The URI in '%s' does not refer to a directory." + % os.path.join('private', 'collective_dircap')) if self._collective_dirnode.is_unknown() or not self._collective_dirnode.is_readonly(): - raise AssertionError("The URI in 'private/collective_dircap' is not a readonly cap to a directory.") + raise AssertionError("The URI in '%s' is not a readonly cap to a directory." + % os.path.join('private', 'collective_dircap')) self._turn_delay = self.REMOTE_SCAN_INTERVAL self._download_scan_batch = {} # path -> [(filenode, metadata)] diff --git a/src/allmydata/scripts/create_node.py b/src/allmydata/scripts/create_node.py index 65cbb63a..f5718ae2 100644 --- a/src/allmydata/scripts/create_node.py +++ b/src/allmydata/scripts/create_node.py @@ -157,7 +157,7 @@ def create_node(config, out=sys.stdout, err=sys.stderr): c.write("# Shall this node automatically upload files created or modified in a local directory?\n") c.write("enabled = false\n") c.write("# To specify the target of uploads, a mutable directory writecap URI must be placed\n" - "# in 'private/drop_upload_dircap'.\n") + "# in '%s'.\n" % os.path.join('private', 'magic_folder_dircap')) c.write("local.directory = ~/drop_upload\n") c.write("\n") diff --git a/src/allmydata/scripts/magic_folder_cli.py b/src/allmydata/scripts/magic_folder_cli.py index 2c98d3c9..37aeec76 100644 --- a/src/allmydata/scripts/magic_folder_cli.py +++ b/src/allmydata/scripts/magic_folder_cli.py @@ -145,12 +145,12 @@ def join(options): raise usage.UsageError("Invalid invite code.") magic_readonly_cap, dmd_write_cap = fields - dmd_cap_file = os.path.join(options["node-directory"], "private/magic_folder_dircap") - collective_readcap_file = os.path.join(options["node-directory"], "private/collective_dircap") + dmd_cap_file = os.path.join(options["node-directory"], u"private", u"magic_folder_dircap") + collective_readcap_file = os.path.join(options["node-directory"], u"private", u"collective_dircap") fileutil.write(dmd_cap_file, dmd_write_cap) fileutil.write(collective_readcap_file, magic_readonly_cap) - fileutil.write(os.path.join(options["node-directory"], "tahoe.cfg"), + fileutil.write(os.path.join(options["node-directory"], u"tahoe.cfg"), "[magic_folder]\nenabled = True\nlocal.directory = %s\n" % (options.local_dir.encode('utf-8'),), mode="ab") return 0 diff --git a/src/allmydata/test/test_cli_magic_folder.py b/src/allmydata/test/test_cli_magic_folder.py index 8c54919a..bb284813 100644 --- a/src/allmydata/test/test_cli_magic_folder.py +++ b/src/allmydata/test/test_cli_magic_folder.py @@ -57,7 +57,8 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin): """Tests that our collective directory has the readonly cap of our upload directory. """ - collective_readonly_cap = fileutil.read(os.path.join(self.get_clientdir(i=client_num), "private/collective_dircap")) + collective_readonly_cap = fileutil.read(os.path.join(self.get_clientdir(i=client_num), + u"private", u"collective_dircap")) d = self.do_cli("ls", "--json", collective_readonly_cap, client_num=client_num) def _done((rc, stdout, stderr)): self.failUnlessEqual(rc, 0) @@ -72,8 +73,10 @@ class MagicFolderCLITestMixin(CLITestMixin, GridTestMixin): return d def get_caps_from_files(self, client_num): - collective_dircap = fileutil.read(os.path.join(self.get_clientdir(i=client_num), "private/collective_dircap")) - upload_dircap = fileutil.read(os.path.join(self.get_clientdir(i=client_num), "private/magic_folder_dircap")) + collective_dircap = fileutil.read(os.path.join(self.get_clientdir(i=client_num), + u"private", u"collective_dircap")) + upload_dircap = fileutil.read(os.path.join(self.get_clientdir(i=client_num), + u"private", u"magic_folder_dircap")) self.failIf(collective_dircap is None or upload_dircap is None) return collective_dircap, upload_dircap diff --git a/src/allmydata/test/test_magic_folder.py b/src/allmydata/test/test_magic_folder.py index 2d60a93e..7cf84bcc 100644 --- a/src/allmydata/test/test_magic_folder.py +++ b/src/allmydata/test/test_magic_folder.py @@ -842,7 +842,7 @@ class MockTest(MagicFolderTestMixin, unittest.TestCase): self.shouldFail(AssertionError, 'readonly upload.dircap', 'is not a writecap to a directory', MagicFolder, client, readonly_dircap, '', errors_dir, magicfolderdb,) self.shouldFail(AssertionError, 'collective dircap', - "The URI in 'private/collective_dircap' is not a readonly cap to a directory.", + "The URI in '%s' is not a readonly cap to a directory." % os.path.join('private', 'collective_dircap'), MagicFolder, client, upload_dircap, upload_dircap, errors_dir, magicfolderdb) def _not_implemented():