From 58d6f9f6cfb9b70f10ed161059eb62c13304ac20 Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Thu, 3 Jun 2021 09:28:10 -0400 Subject: [PATCH] Port to Python 3. --- src/allmydata/scripts/tahoe_mv.py | 14 +++++++++++--- src/allmydata/util/_python3.py | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/allmydata/scripts/tahoe_mv.py b/src/allmydata/scripts/tahoe_mv.py index 84f83edcd..d921047a8 100644 --- a/src/allmydata/scripts/tahoe_mv.py +++ b/src/allmydata/scripts/tahoe_mv.py @@ -1,6 +1,14 @@ +""" +Ported to Python 3. +""" +from __future__ import unicode_literals +from __future__ import absolute_import +from __future__ import division from __future__ import print_function -from past.builtins import unicode +from future.utils import PY2 +if PY2: + from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, str, max, min # noqa: F401 import re from urllib.parse import quote as url_quote @@ -27,7 +35,7 @@ def mv(options, mode="move"): except UnknownAliasError as e: e.display(stderr) return 1 - from_path = unicode(from_path, "utf-8") + from_path = str(from_path, "utf-8") from_url = nodeurl + "uri/%s" % url_quote(rootcap) if from_path: from_url += "/" + escape_path(from_path) @@ -47,7 +55,7 @@ def mv(options, mode="move"): e.display(stderr) return 1 to_url = nodeurl + "uri/%s" % url_quote(rootcap) - path = unicode(path, "utf-8") + path = str(path, "utf-8") if path: to_url += "/" + escape_path(path) diff --git a/src/allmydata/util/_python3.py b/src/allmydata/util/_python3.py index 6979efdd3..829cae829 100644 --- a/src/allmydata/util/_python3.py +++ b/src/allmydata/util/_python3.py @@ -111,6 +111,7 @@ PORTED_MODULES = [ "allmydata.scripts.tahoe_ls", "allmydata.scripts.tahoe_manifest", "allmydata.scripts.tahoe_mkdir", + "allmydata.scripts.tahoe_mv", "allmydata.scripts.types_", "allmydata.stats", "allmydata.storage_client",