From d04b6c103a0a06c0a7993535c85122946dc87da1 Mon Sep 17 00:00:00 2001 From: Chad Whitacre Date: Wed, 28 Oct 2020 14:54:10 -0400 Subject: [PATCH] Pick off a couple of easy ports --- newsfragments/3474.minor | 0 src/allmydata/__main__.py | 13 +++++++++++++ src/allmydata/_auto_deps.py | 13 +++++++++++++ src/allmydata/test/test_version.py | 2 +- src/allmydata/util/_python3.py | 4 +++- 5 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 newsfragments/3474.minor diff --git a/newsfragments/3474.minor b/newsfragments/3474.minor new file mode 100644 index 000000000..e69de29bb diff --git a/src/allmydata/__main__.py b/src/allmydata/__main__.py index 25a67ea4e..87f1f6522 100644 --- a/src/allmydata/__main__.py +++ b/src/allmydata/__main__.py @@ -1,3 +1,16 @@ +""" +Ported to Python 3. +""" + +from __future__ import unicode_literals +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +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 sys from allmydata.scripts.runner import run diff --git a/src/allmydata/_auto_deps.py b/src/allmydata/_auto_deps.py index 17f39cfcc..521b17a45 100644 --- a/src/allmydata/_auto_deps.py +++ b/src/allmydata/_auto_deps.py @@ -1,3 +1,16 @@ +""" +Ported to Python 3. +""" + +from __future__ import unicode_literals +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function + +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 + # Note: please minimize imports in this file. In particular, do not import # any module from Tahoe-LAFS or its dependencies, and do not import any # modules at all at global level. That includes setuptools and pkg_resources. diff --git a/src/allmydata/test/test_version.py b/src/allmydata/test/test_version.py index 7301399d9..f5f92ef9b 100644 --- a/src/allmydata/test/test_version.py +++ b/src/allmydata/test/test_version.py @@ -272,4 +272,4 @@ class T(unittest.TestCase): foolscap_stuffs = [stuff for (pkg, stuff) in vers_and_locs if pkg == 'foolscap'] self.failUnlessEqual(len(foolscap_stuffs), 1) - self.failUnless([e for e in errors if "dependency \'foolscap\' could not be imported" in e]) + self.failUnless([e for e in errors if "\'foolscap\' could not be imported" in e]) diff --git a/src/allmydata/util/_python3.py b/src/allmydata/util/_python3.py index b7db7a32a..bffdbdded 100644 --- a/src/allmydata/util/_python3.py +++ b/src/allmydata/util/_python3.py @@ -24,6 +24,8 @@ if PY2: # Keep these sorted alphabetically, to reduce merge conflicts: PORTED_MODULES = [ + "allmydata.__main__", + "allmydata._auto_deps", "allmydata._monkeypatch", "allmydata.codec", "allmydata.crypto", @@ -69,9 +71,9 @@ PORTED_MODULES = [ "allmydata.util.configutil", "allmydata.util.connection_status", "allmydata.util.deferredutil", - "allmydata.util.fileutil", "allmydata.util.dictutil", "allmydata.util.encodingutil", + "allmydata.util.fileutil", "allmydata.util.gcutil", "allmydata.util.happinessutil", "allmydata.util.hashutil",