From e97043eeae0fc38202d5f3f56760a81b511ca5f0 Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Tue, 30 Mar 2021 09:58:22 -0400 Subject: [PATCH 1/3] News file. --- newsfragments/3655.minor | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 newsfragments/3655.minor diff --git a/newsfragments/3655.minor b/newsfragments/3655.minor new file mode 100644 index 000000000..e69de29bb From 90c393b8b22607a986ce596b4e70f8a7ce707843 Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Tue, 30 Mar 2021 10:04:28 -0400 Subject: [PATCH 2/3] Port __init__.py modules to Python 3 (or just mark them as ported if they're empty). --- src/allmydata/introducer/__init__.py | 13 +++++++++++++ src/allmydata/test/__init__.py | 12 ++++++++++-- src/allmydata/util/_python3.py | 14 ++++++++++++++ 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/allmydata/introducer/__init__.py b/src/allmydata/introducer/__init__.py index c4a644e76..bfc960e05 100644 --- a/src/allmydata/introducer/__init__.py +++ b/src/allmydata/introducer/__init__.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 + from allmydata.introducer.server import create_introducer diff --git a/src/allmydata/test/__init__.py b/src/allmydata/test/__init__.py index e3ac48290..a1cbb76a1 100644 --- a/src/allmydata/test/__init__.py +++ b/src/allmydata/test/__init__.py @@ -12,9 +12,17 @@ Some setup that should apply across the entire test suite. Rather than defining interesting APIs for other code to use, this just causes some side-effects which make things better when the test suite runs. -""" -from future.utils import PY3 +Ported to Python 3. +""" +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +from future.utils import PY2, PY3 +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 warnings from traceback import extract_stack, format_list diff --git a/src/allmydata/util/_python3.py b/src/allmydata/util/_python3.py index f26b77185..db2b3307a 100644 --- a/src/allmydata/util/_python3.py +++ b/src/allmydata/util/_python3.py @@ -40,9 +40,11 @@ PORTED_MODULES = [ "allmydata.crypto.util", "allmydata.deep_stats", "allmydata.dirnode", + "allmydata.frontends", "allmydata.frontends.sftpd", "allmydata.hashtree", "allmydata.history", + "allmydata.immutable", "allmydata.immutable.checker", "allmydata.immutable.downloader", "allmydata.immutable.downloader.common", @@ -61,11 +63,13 @@ PORTED_MODULES = [ "allmydata.immutable.repairer", "allmydata.immutable.upload", "allmydata.interfaces", + "allmydata.introducer", "allmydata.introducer.client", "allmydata.introducer.common", "allmydata.introducer.interfaces", "allmydata.introducer.server", "allmydata.monitor", + "allmydata.mutable", "allmydata.mutable.checker", "allmydata.mutable.common", "allmydata.mutable.filenode", @@ -76,10 +80,12 @@ PORTED_MODULES = [ "allmydata.mutable.servermap", "allmydata.node", "allmydata.nodemaker", + "allmydata.scripts", "allmydata.scripts.create_node", "allmydata.scripts.types_", "allmydata.stats", "allmydata.storage_client", + "allmydata.storage", "allmydata.storage.common", "allmydata.storage.crawler", "allmydata.storage.expirer", @@ -88,12 +94,18 @@ PORTED_MODULES = [ "allmydata.storage.mutable", "allmydata.storage.server", "allmydata.storage.shares", + "allmydata.test", + "allmydata.test.cli", "allmydata.test.no_network", "allmydata.test.matchers", + "allmydata.test.mutable", "allmydata.test.mutable.util", + "allmydata.test.web", + "allmydata.testing", "allmydata.testing.web", "allmydata.unknown", "allmydata.uri", + "allmydata.util", "allmydata.util._python3", "allmydata.util.abbreviate", "allmydata.util.assertutil", @@ -125,6 +137,7 @@ PORTED_MODULES = [ "allmydata.util.statistics", "allmydata.util.time_format", "allmydata.util.tor_provider", + "allmydata.web", "allmydata.web.check_results", "allmydata.web.common", "allmydata.web.directory", @@ -140,6 +153,7 @@ PORTED_MODULES = [ "allmydata.web.storage_plugins", "allmydata.web.unlinked", "allmydata.webish", + "allmydata.windows", ] PORTED_TEST_MODULES = [ From 45e21f8f703f26a8e98af04c3042428de5d80e1b Mon Sep 17 00:00:00 2001 From: Itamar Turner-Trauring Date: Tue, 30 Mar 2021 11:05:49 -0400 Subject: [PATCH 3/3] Port to Python 3. --- src/allmydata/__init__.py | 10 ++++++++++ src/allmydata/test/__init__.py | 2 +- src/allmydata/util/_python3.py | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/allmydata/__init__.py b/src/allmydata/__init__.py index 3157c8c80..b29868c05 100644 --- a/src/allmydata/__init__.py +++ b/src/allmydata/__init__.py @@ -3,6 +3,16 @@ Decentralized storage grid. community web site: U{https://tahoe-lafs.org/} """ +from __future__ import absolute_import +from __future__ import division +from __future__ import print_function +from __future__ import unicode_literals + +from future.utils import PY2 +if PY2: + # Don't import future str() so we don't break Foolscap serialization on Python 2. + from future.builtins import filter, map, zip, ascii, chr, hex, input, next, oct, open, pow, round, super, bytes, dict, list, object, range, max, min # noqa: F401 + from past.builtins import unicode as str __all__ = [ "__version__", diff --git a/src/allmydata/test/__init__.py b/src/allmydata/test/__init__.py index a1cbb76a1..c75f8d003 100644 --- a/src/allmydata/test/__init__.py +++ b/src/allmydata/test/__init__.py @@ -132,4 +132,4 @@ if sys.platform == "win32": from eliot import to_file from allmydata.util.jsonbytes import BytesJSONEncoder -to_file(open("eliot.log", "w"), encoder=BytesJSONEncoder) +to_file(open("eliot.log", "wb"), encoder=BytesJSONEncoder) diff --git a/src/allmydata/util/_python3.py b/src/allmydata/util/_python3.py index db2b3307a..0d7f1561c 100644 --- a/src/allmydata/util/_python3.py +++ b/src/allmydata/util/_python3.py @@ -24,6 +24,7 @@ if PY2: # Keep these sorted alphabetically, to reduce merge conflicts: PORTED_MODULES = [ + "allmydata", "allmydata.__main__", "allmydata._auto_deps", "allmydata._monkeypatch",