diff --git a/newsfragments/3655.minor b/newsfragments/3655.minor new file mode 100644 index 000000000..e69de29bb 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/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..c75f8d003 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 @@ -124,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 f26b77185..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", @@ -40,9 +41,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 +64,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 +81,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 +95,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 +138,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 +154,7 @@ PORTED_MODULES = [ "allmydata.web.storage_plugins", "allmydata.web.unlinked", "allmydata.webish", + "allmydata.windows", ] PORTED_TEST_MODULES = [