From c890a850aa4039e21ed44dfb0b7959f94be7265b Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 20 Apr 2016 18:44:33 -0700 Subject: [PATCH 01/10] unsplit tests step 1: move files --- {tests => src/wormhole/test}/__init__.py | 0 {tests => src/wormhole/test}/common.py | 0 {tests => src/wormhole/test}/test_blocking.py | 0 {tests => src/wormhole/test}/test_hkdf.py | 0 {tests => src/wormhole/test}/test_interop.py | 0 {tests => src/wormhole/test}/test_load.py | 0 {tests => src/wormhole/test}/test_progress.py | 0 {tests => src/wormhole/test}/test_scripts.py | 0 {tests => src/wormhole/test}/test_server.py | 0 {tests => src/wormhole/test}/test_transit_twisted.py | 0 {tests => src/wormhole/test}/test_twisted.py | 0 11 files changed, 0 insertions(+), 0 deletions(-) rename {tests => src/wormhole/test}/__init__.py (100%) rename {tests => src/wormhole/test}/common.py (100%) rename {tests => src/wormhole/test}/test_blocking.py (100%) rename {tests => src/wormhole/test}/test_hkdf.py (100%) rename {tests => src/wormhole/test}/test_interop.py (100%) rename {tests => src/wormhole/test}/test_load.py (100%) rename {tests => src/wormhole/test}/test_progress.py (100%) rename {tests => src/wormhole/test}/test_scripts.py (100%) rename {tests => src/wormhole/test}/test_server.py (100%) rename {tests => src/wormhole/test}/test_transit_twisted.py (100%) rename {tests => src/wormhole/test}/test_twisted.py (100%) diff --git a/tests/__init__.py b/src/wormhole/test/__init__.py similarity index 100% rename from tests/__init__.py rename to src/wormhole/test/__init__.py diff --git a/tests/common.py b/src/wormhole/test/common.py similarity index 100% rename from tests/common.py rename to src/wormhole/test/common.py diff --git a/tests/test_blocking.py b/src/wormhole/test/test_blocking.py similarity index 100% rename from tests/test_blocking.py rename to src/wormhole/test/test_blocking.py diff --git a/tests/test_hkdf.py b/src/wormhole/test/test_hkdf.py similarity index 100% rename from tests/test_hkdf.py rename to src/wormhole/test/test_hkdf.py diff --git a/tests/test_interop.py b/src/wormhole/test/test_interop.py similarity index 100% rename from tests/test_interop.py rename to src/wormhole/test/test_interop.py diff --git a/tests/test_load.py b/src/wormhole/test/test_load.py similarity index 100% rename from tests/test_load.py rename to src/wormhole/test/test_load.py diff --git a/tests/test_progress.py b/src/wormhole/test/test_progress.py similarity index 100% rename from tests/test_progress.py rename to src/wormhole/test/test_progress.py diff --git a/tests/test_scripts.py b/src/wormhole/test/test_scripts.py similarity index 100% rename from tests/test_scripts.py rename to src/wormhole/test/test_scripts.py diff --git a/tests/test_server.py b/src/wormhole/test/test_server.py similarity index 100% rename from tests/test_server.py rename to src/wormhole/test/test_server.py diff --git a/tests/test_transit_twisted.py b/src/wormhole/test/test_transit_twisted.py similarity index 100% rename from tests/test_transit_twisted.py rename to src/wormhole/test/test_transit_twisted.py diff --git a/tests/test_twisted.py b/src/wormhole/test/test_twisted.py similarity index 100% rename from tests/test_twisted.py rename to src/wormhole/test/test_twisted.py From fc33ea41ffd254de984119badd4209b2de364637 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 20 Apr 2016 18:51:03 -0700 Subject: [PATCH 02/10] unsplit tests step 2: delete test_load --- src/wormhole/test/test_load.py | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 src/wormhole/test/test_load.py diff --git a/src/wormhole/test/test_load.py b/src/wormhole/test/test_load.py deleted file mode 100644 index 6902a3a..0000000 --- a/src/wormhole/test/test_load.py +++ /dev/null @@ -1,12 +0,0 @@ -import unittest - -class Import(unittest.TestCase): - def test_import(self): - import wormhole - self.assertTrue(len(wormhole.__version__)) - import wormhole_server - self.assertTrue(len(wormhole_server.__version__)) - import txwormhole - self.assertTrue(len(txwormhole.__version__)) - import wormhole_cli - self.assertTrue(len(wormhole_cli.__version__)) From 7a5a99a1a827d29261177a986bbc51a9c0d147c9 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 20 Apr 2016 18:54:10 -0700 Subject: [PATCH 03/10] unsplit tests step 3: modify files --- setup.py | 4 +++- src/wormhole/test/common.py | 2 +- src/wormhole/test/test_blocking.py | 6 +++--- src/wormhole/test/test_interop.py | 2 +- src/wormhole/test/test_scripts.py | 6 +++--- src/wormhole/test/test_server.py | 2 +- src/wormhole/test/test_transit_twisted.py | 2 +- tox.ini | 4 ++-- 8 files changed, 15 insertions(+), 13 deletions(-) diff --git a/setup.py b/setup.py index 73dd899..7e4aca4 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,9 @@ setup(name="magic-wormhole", "wormhole.blocking", "txwormhole", "wormhole_cli", - "wormhole_server"], + "wormhole_server", + "wormhole.test", + ], package_data={"wormhole_server": ["db-schemas/*.sql"]}, entry_points={"console_scripts": ["wormhole = wormhole_cli.runner:entry", diff --git a/src/wormhole/test/common.py b/src/wormhole/test/common.py index 96f1548..5436fdb 100644 --- a/src/wormhole/test/common.py +++ b/src/wormhole/test/common.py @@ -3,7 +3,7 @@ from twisted.internet import reactor, defer from twisted.python import log from txwormhole.transit import allocate_tcp_port from wormhole_server.server import RelayServer -from wormhole import __version__ +from .. import __version__ class ServerBase: def setUp(self): diff --git a/src/wormhole/test/test_blocking.py b/src/wormhole/test/test_blocking.py index cb35714..7ba8222 100644 --- a/src/wormhole/test/test_blocking.py +++ b/src/wormhole/test/test_blocking.py @@ -3,9 +3,9 @@ import json from twisted.trial import unittest from twisted.internet.defer import gatherResults, succeed from twisted.internet.threads import deferToThread -from wormhole.blocking.transcribe import (Wormhole, UsageError, ChannelManager, - WrongPasswordError) -from wormhole.blocking.eventsource import EventSourceFollower +from ..blocking.transcribe import (Wormhole, UsageError, ChannelManager, + WrongPasswordError) +from ..blocking.eventsource import EventSourceFollower from .common import ServerBase APPID = u"appid" diff --git a/src/wormhole/test/test_interop.py b/src/wormhole/test/test_interop.py index ec655af..f216a6e 100644 --- a/src/wormhole/test/test_interop.py +++ b/src/wormhole/test/test_interop.py @@ -3,7 +3,7 @@ from twisted.trial import unittest from twisted.internet.defer import gatherResults from twisted.internet.threads import deferToThread from txwormhole.transcribe import Wormhole as twisted_Wormhole -from wormhole.blocking.transcribe import Wormhole as blocking_Wormhole +from ..blocking.transcribe import Wormhole as blocking_Wormhole from .common import ServerBase # make sure the two implementations (Twisted-style and blocking-style) can diff --git a/src/wormhole/test/test_scripts.py b/src/wormhole/test/test_scripts.py index d05f148..ea4234e 100644 --- a/src/wormhole/test/test_scripts.py +++ b/src/wormhole/test/test_scripts.py @@ -4,12 +4,12 @@ from twisted.trial import unittest from twisted.python import procutils, log from twisted.internet.utils import getProcessOutputAndValue from twisted.internet.defer import inlineCallbacks -from wormhole import __version__ +from .. import __version__ from .common import ServerBase from wormhole_cli import runner, cmd_send, cmd_receive from wormhole_cli.cmd_send import build_phase1_data -from wormhole.errors import TransferError -from wormhole.timing import DebugTiming +from ..errors import TransferError +from ..timing import DebugTiming class Phase1Data(unittest.TestCase): def setUp(self): diff --git a/src/wormhole/test/test_server.py b/src/wormhole/test/test_server.py index 76e4128..1d7da4a 100644 --- a/src/wormhole/test/test_server.py +++ b/src/wormhole/test/test_server.py @@ -10,7 +10,7 @@ from twisted.internet.threads import deferToThread from twisted.internet.endpoints import clientFromString, connectProtocol from twisted.web.client import getPage, Agent, readBody from autobahn.twisted import websocket -from wormhole import __version__ +from .. import __version__ from .common import ServerBase from wormhole_server import rendezvous, transit_server from txwormhole.eventsource import EventSource diff --git a/src/wormhole/test/test_transit_twisted.py b/src/wormhole/test/test_transit_twisted.py index fd42291..2a4e50d 100644 --- a/src/wormhole/test/test_transit_twisted.py +++ b/src/wormhole/test/test_transit_twisted.py @@ -7,7 +7,7 @@ from twisted.internet.defer import gatherResults, inlineCallbacks from twisted.python import log, failure from twisted.test import proto_helpers from txwormhole import transit -from wormhole.errors import UsageError +from ..errors import UsageError from nacl.secret import SecretBox from nacl.exceptions import CryptoError diff --git a/tox.ini b/tox.ini index f84db2d..80751e4 100644 --- a/tox.ini +++ b/tox.ini @@ -21,9 +21,9 @@ deps = pyflakes {env:EXTRA_DEPENDENCY:} commands = - pyflakes setup.py src tests + pyflakes setup.py src wormhole --version - trial {posargs:tests} + trial {posargs:wormhole.test} # on windows, trial is installed as venv/bin/trial.py, not .exe, but (at # least appveyor) adds .PY to $PATHEXT. So "trial wormhole" might work on From a3c836bcd3299ed50b4be024265132e5489f7005 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 20 Apr 2016 18:39:17 -0700 Subject: [PATCH 04/10] unsplit cli step 1: move files --- src/{wormhole_cli => wormhole/cli}/__init__.py | 0 src/{wormhole_cli => wormhole/cli}/cli_args.py | 0 src/{wormhole_cli => wormhole/cli}/cmd_receive.py | 0 src/{wormhole_cli => wormhole/cli}/cmd_send.py | 0 src/{wormhole_cli => wormhole/cli}/progress.py | 0 src/{wormhole_cli => wormhole/cli}/public_relay.py | 0 src/{wormhole_cli => wormhole/cli}/runner.py | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename src/{wormhole_cli => wormhole/cli}/__init__.py (100%) rename src/{wormhole_cli => wormhole/cli}/cli_args.py (100%) rename src/{wormhole_cli => wormhole/cli}/cmd_receive.py (100%) rename src/{wormhole_cli => wormhole/cli}/cmd_send.py (100%) rename src/{wormhole_cli => wormhole/cli}/progress.py (100%) rename src/{wormhole_cli => wormhole/cli}/public_relay.py (100%) rename src/{wormhole_cli => wormhole/cli}/runner.py (100%) diff --git a/src/wormhole_cli/__init__.py b/src/wormhole/cli/__init__.py similarity index 100% rename from src/wormhole_cli/__init__.py rename to src/wormhole/cli/__init__.py diff --git a/src/wormhole_cli/cli_args.py b/src/wormhole/cli/cli_args.py similarity index 100% rename from src/wormhole_cli/cli_args.py rename to src/wormhole/cli/cli_args.py diff --git a/src/wormhole_cli/cmd_receive.py b/src/wormhole/cli/cmd_receive.py similarity index 100% rename from src/wormhole_cli/cmd_receive.py rename to src/wormhole/cli/cmd_receive.py diff --git a/src/wormhole_cli/cmd_send.py b/src/wormhole/cli/cmd_send.py similarity index 100% rename from src/wormhole_cli/cmd_send.py rename to src/wormhole/cli/cmd_send.py diff --git a/src/wormhole_cli/progress.py b/src/wormhole/cli/progress.py similarity index 100% rename from src/wormhole_cli/progress.py rename to src/wormhole/cli/progress.py diff --git a/src/wormhole_cli/public_relay.py b/src/wormhole/cli/public_relay.py similarity index 100% rename from src/wormhole_cli/public_relay.py rename to src/wormhole/cli/public_relay.py diff --git a/src/wormhole_cli/runner.py b/src/wormhole/cli/runner.py similarity index 100% rename from src/wormhole_cli/runner.py rename to src/wormhole/cli/runner.py From 85b6264826559a98ef6d7321697ac2b7c96a7ef9 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 20 Apr 2016 18:42:28 -0700 Subject: [PATCH 05/10] unsplit cli step 2: edit files --- setup.py | 4 ++-- src/wormhole/cli/__init__.py | 2 -- src/wormhole/cli/cli_args.py | 2 +- src/wormhole/cli/cmd_receive.py | 2 +- src/wormhole/cli/cmd_send.py | 2 +- src/wormhole/cli/runner.py | 2 +- src/wormhole/test/test_progress.py | 2 +- src/wormhole/test/test_scripts.py | 4 ++-- 8 files changed, 9 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index 7e4aca4..bed9edf 100644 --- a/setup.py +++ b/setup.py @@ -16,13 +16,13 @@ setup(name="magic-wormhole", packages=["wormhole", "wormhole.blocking", "txwormhole", - "wormhole_cli", + "wormhole.cli", "wormhole_server", "wormhole.test", ], package_data={"wormhole_server": ["db-schemas/*.sql"]}, entry_points={"console_scripts": - ["wormhole = wormhole_cli.runner:entry", + ["wormhole = wormhole.cli.runner:entry", "wormhole-server = wormhole_server.runner:entry", ]}, install_requires=["spake2==0.3", "pynacl", "requests", "argparse", diff --git a/src/wormhole/cli/__init__.py b/src/wormhole/cli/__init__.py index 0ff5129..e69de29 100644 --- a/src/wormhole/cli/__init__.py +++ b/src/wormhole/cli/__init__.py @@ -1,2 +0,0 @@ -from wormhole import __version__ -__version__ # hush pyflakes diff --git a/src/wormhole/cli/cli_args.py b/src/wormhole/cli/cli_args.py index cd22452..793a171 100644 --- a/src/wormhole/cli/cli_args.py +++ b/src/wormhole/cli/cli_args.py @@ -1,7 +1,7 @@ import argparse from textwrap import dedent from . import public_relay -from wormhole import __version__ +from .. import __version__ parser = argparse.ArgumentParser( usage="wormhole SUBCOMMAND (subcommand-options)", diff --git a/src/wormhole/cli/cmd_receive.py b/src/wormhole/cli/cmd_receive.py index 23f89c0..c4d03e4 100644 --- a/src/wormhole/cli/cmd_receive.py +++ b/src/wormhole/cli/cmd_receive.py @@ -4,7 +4,7 @@ from twisted.internet import reactor, defer from twisted.internet.defer import inlineCallbacks, returnValue from txwormhole.transcribe import Wormhole, WrongPasswordError from txwormhole.transit import TransitReceiver -from wormhole.errors import TransferError +from ..errors import TransferError from .progress import ProgressPrinter diff --git a/src/wormhole/cli/cmd_send.py b/src/wormhole/cli/cmd_send.py index 633c9aa..e3faa4b 100644 --- a/src/wormhole/cli/cmd_send.py +++ b/src/wormhole/cli/cmd_send.py @@ -3,7 +3,7 @@ import os, sys, io, json, binascii, six, tempfile, zipfile from twisted.protocols import basic from twisted.internet import reactor from twisted.internet.defer import inlineCallbacks, returnValue -from wormhole.errors import TransferError +from ..errors import TransferError from .progress import ProgressPrinter from txwormhole.transcribe import Wormhole, WrongPasswordError from txwormhole.transit import TransitSender diff --git a/src/wormhole/cli/runner.py b/src/wormhole/cli/runner.py index 5bebbde..2249b6a 100644 --- a/src/wormhole/cli/runner.py +++ b/src/wormhole/cli/runner.py @@ -2,7 +2,7 @@ from __future__ import print_function import os, sys from twisted.internet.defer import maybeDeferred from twisted.internet.task import react -from wormhole.timing import DebugTiming +from ..timing import DebugTiming from .cli_args import parser def dispatch(args): # returns Deferred diff --git a/src/wormhole/test/test_progress.py b/src/wormhole/test/test_progress.py index 511c173..b48a105 100644 --- a/src/wormhole/test/test_progress.py +++ b/src/wormhole/test/test_progress.py @@ -1,7 +1,7 @@ from __future__ import print_function import io, time from twisted.trial import unittest -from wormhole_cli import progress +from ..cli import progress class Progress(unittest.TestCase): def test_time(self): diff --git a/src/wormhole/test/test_scripts.py b/src/wormhole/test/test_scripts.py index ea4234e..0de287a 100644 --- a/src/wormhole/test/test_scripts.py +++ b/src/wormhole/test/test_scripts.py @@ -6,8 +6,8 @@ from twisted.internet.utils import getProcessOutputAndValue from twisted.internet.defer import inlineCallbacks from .. import __version__ from .common import ServerBase -from wormhole_cli import runner, cmd_send, cmd_receive -from wormhole_cli.cmd_send import build_phase1_data +from ..cli import runner, cmd_send, cmd_receive +from ..cli.cmd_send import build_phase1_data from ..errors import TransferError from ..timing import DebugTiming From ec13404fca9c06aadd9cabe00c50ee7fb9170486 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 20 Apr 2016 18:58:43 -0700 Subject: [PATCH 06/10] unsplit wormhole_server step 1: move files --- src/{wormhole_server => wormhole/server}/__init__.py | 0 src/{wormhole_server => wormhole/server}/cli_args.py | 0 src/{wormhole_server => wormhole/server}/cmd_server.py | 0 src/{wormhole_server => wormhole/server}/cmd_usage.py | 0 src/{wormhole_server => wormhole/server}/database.py | 0 src/{wormhole_server => wormhole/server}/db-schemas/v1.sql | 0 src/{wormhole_server => wormhole/server}/endpoint_service.py | 0 src/{wormhole_server => wormhole/server}/rendezvous.py | 0 src/{wormhole_server => wormhole/server}/rendezvous_web.py | 0 src/{wormhole_server => wormhole/server}/rendezvous_websocket.py | 0 src/{wormhole_server => wormhole/server}/runner.py | 0 src/{wormhole_server => wormhole/server}/server.py | 0 src/{wormhole_server => wormhole/server}/transit_server.py | 0 13 files changed, 0 insertions(+), 0 deletions(-) rename src/{wormhole_server => wormhole/server}/__init__.py (100%) rename src/{wormhole_server => wormhole/server}/cli_args.py (100%) rename src/{wormhole_server => wormhole/server}/cmd_server.py (100%) rename src/{wormhole_server => wormhole/server}/cmd_usage.py (100%) rename src/{wormhole_server => wormhole/server}/database.py (100%) rename src/{wormhole_server => wormhole/server}/db-schemas/v1.sql (100%) rename src/{wormhole_server => wormhole/server}/endpoint_service.py (100%) rename src/{wormhole_server => wormhole/server}/rendezvous.py (100%) rename src/{wormhole_server => wormhole/server}/rendezvous_web.py (100%) rename src/{wormhole_server => wormhole/server}/rendezvous_websocket.py (100%) rename src/{wormhole_server => wormhole/server}/runner.py (100%) rename src/{wormhole_server => wormhole/server}/server.py (100%) rename src/{wormhole_server => wormhole/server}/transit_server.py (100%) diff --git a/src/wormhole_server/__init__.py b/src/wormhole/server/__init__.py similarity index 100% rename from src/wormhole_server/__init__.py rename to src/wormhole/server/__init__.py diff --git a/src/wormhole_server/cli_args.py b/src/wormhole/server/cli_args.py similarity index 100% rename from src/wormhole_server/cli_args.py rename to src/wormhole/server/cli_args.py diff --git a/src/wormhole_server/cmd_server.py b/src/wormhole/server/cmd_server.py similarity index 100% rename from src/wormhole_server/cmd_server.py rename to src/wormhole/server/cmd_server.py diff --git a/src/wormhole_server/cmd_usage.py b/src/wormhole/server/cmd_usage.py similarity index 100% rename from src/wormhole_server/cmd_usage.py rename to src/wormhole/server/cmd_usage.py diff --git a/src/wormhole_server/database.py b/src/wormhole/server/database.py similarity index 100% rename from src/wormhole_server/database.py rename to src/wormhole/server/database.py diff --git a/src/wormhole_server/db-schemas/v1.sql b/src/wormhole/server/db-schemas/v1.sql similarity index 100% rename from src/wormhole_server/db-schemas/v1.sql rename to src/wormhole/server/db-schemas/v1.sql diff --git a/src/wormhole_server/endpoint_service.py b/src/wormhole/server/endpoint_service.py similarity index 100% rename from src/wormhole_server/endpoint_service.py rename to src/wormhole/server/endpoint_service.py diff --git a/src/wormhole_server/rendezvous.py b/src/wormhole/server/rendezvous.py similarity index 100% rename from src/wormhole_server/rendezvous.py rename to src/wormhole/server/rendezvous.py diff --git a/src/wormhole_server/rendezvous_web.py b/src/wormhole/server/rendezvous_web.py similarity index 100% rename from src/wormhole_server/rendezvous_web.py rename to src/wormhole/server/rendezvous_web.py diff --git a/src/wormhole_server/rendezvous_websocket.py b/src/wormhole/server/rendezvous_websocket.py similarity index 100% rename from src/wormhole_server/rendezvous_websocket.py rename to src/wormhole/server/rendezvous_websocket.py diff --git a/src/wormhole_server/runner.py b/src/wormhole/server/runner.py similarity index 100% rename from src/wormhole_server/runner.py rename to src/wormhole/server/runner.py diff --git a/src/wormhole_server/server.py b/src/wormhole/server/server.py similarity index 100% rename from src/wormhole_server/server.py rename to src/wormhole/server/server.py diff --git a/src/wormhole_server/transit_server.py b/src/wormhole/server/transit_server.py similarity index 100% rename from src/wormhole_server/transit_server.py rename to src/wormhole/server/transit_server.py From 7c45f3d4725d9debf63ee935069f3a26e60dc4e9 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 20 Apr 2016 19:04:01 -0700 Subject: [PATCH 07/10] unsplit wormhole_server step 2: edit files --- setup.py | 6 +++--- src/wormhole/server/__init__.py | 2 -- src/wormhole/server/cli_args.py | 2 +- src/wormhole/server/cmd_usage.py | 2 +- src/wormhole/server/database.py | 2 +- src/wormhole/server/server.py | 2 +- src/wormhole/test/common.py | 2 +- src/wormhole/test/test_server.py | 2 +- 8 files changed, 9 insertions(+), 11 deletions(-) diff --git a/setup.py b/setup.py index bed9edf..4a01c6a 100644 --- a/setup.py +++ b/setup.py @@ -17,13 +17,13 @@ setup(name="magic-wormhole", "wormhole.blocking", "txwormhole", "wormhole.cli", - "wormhole_server", + "wormhole.server", "wormhole.test", ], - package_data={"wormhole_server": ["db-schemas/*.sql"]}, + package_data={"wormhole.server": ["db-schemas/*.sql"]}, entry_points={"console_scripts": ["wormhole = wormhole.cli.runner:entry", - "wormhole-server = wormhole_server.runner:entry", + "wormhole-server = wormhole.server.runner:entry", ]}, install_requires=["spake2==0.3", "pynacl", "requests", "argparse", "six", "twisted >= 16.1.0", "hkdf", diff --git a/src/wormhole/server/__init__.py b/src/wormhole/server/__init__.py index 0ff5129..e69de29 100644 --- a/src/wormhole/server/__init__.py +++ b/src/wormhole/server/__init__.py @@ -1,2 +0,0 @@ -from wormhole import __version__ -__version__ # hush pyflakes diff --git a/src/wormhole/server/cli_args.py b/src/wormhole/server/cli_args.py index f37946a..4bc87e1 100644 --- a/src/wormhole/server/cli_args.py +++ b/src/wormhole/server/cli_args.py @@ -1,6 +1,6 @@ import argparse from textwrap import dedent -from wormhole import __version__ +from .. import __version__ parser = argparse.ArgumentParser( usage="wormhole-server SUBCOMMAND (subcommand-options)", diff --git a/src/wormhole/server/cmd_usage.py b/src/wormhole/server/cmd_usage.py index e021206..6f46b7e 100644 --- a/src/wormhole/server/cmd_usage.py +++ b/src/wormhole/server/cmd_usage.py @@ -2,7 +2,7 @@ from __future__ import print_function import os, time from collections import defaultdict from .database import get_db -from wormhole.errors import UsageError +from ..errors import UsageError def abbrev(t): if t is None: diff --git a/src/wormhole/server/database.py b/src/wormhole/server/database.py index 66ed1d0..d8edee0 100644 --- a/src/wormhole/server/database.py +++ b/src/wormhole/server/database.py @@ -6,7 +6,7 @@ class DBError(Exception): pass def get_schema(version): - schema_bytes = resource_string("wormhole_server", + schema_bytes = resource_string("wormhole.server", "db-schemas/v%d.sql" % version) return schema_bytes.decode("utf-8") diff --git a/src/wormhole/server/server.py b/src/wormhole/server/server.py index 7a40012..166a6ba 100644 --- a/src/wormhole/server/server.py +++ b/src/wormhole/server/server.py @@ -5,7 +5,7 @@ from twisted.application import service from twisted.web import server, static, resource from autobahn.twisted.resource import WebSocketResource from .endpoint_service import ServerEndpointService -from wormhole import __version__ +from .. import __version__ from .database import get_db from .rendezvous import Rendezvous from .rendezvous_web import WebRendezvous diff --git a/src/wormhole/test/common.py b/src/wormhole/test/common.py index 5436fdb..bffa9c5 100644 --- a/src/wormhole/test/common.py +++ b/src/wormhole/test/common.py @@ -2,7 +2,7 @@ from twisted.application import service from twisted.internet import reactor, defer from twisted.python import log from txwormhole.transit import allocate_tcp_port -from wormhole_server.server import RelayServer +from ..server.server import RelayServer from .. import __version__ class ServerBase: diff --git a/src/wormhole/test/test_server.py b/src/wormhole/test/test_server.py index 1d7da4a..bd5f47f 100644 --- a/src/wormhole/test/test_server.py +++ b/src/wormhole/test/test_server.py @@ -12,7 +12,7 @@ from twisted.web.client import getPage, Agent, readBody from autobahn.twisted import websocket from .. import __version__ from .common import ServerBase -from wormhole_server import rendezvous, transit_server +from ..server import rendezvous, transit_server from txwormhole.eventsource import EventSource class Reachable(ServerBase, unittest.TestCase): From 0ae8463331bcb2d0355c6abcd2d3e5c1612a92ef Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 20 Apr 2016 19:05:27 -0700 Subject: [PATCH 08/10] unsplit txwormhole step 1: move files --- src/{txwormhole => wormhole/twisted}/__init__.py | 0 src/{txwormhole => wormhole/twisted}/eventsource.py | 0 src/{txwormhole => wormhole/twisted}/eventual.py | 0 src/{txwormhole => wormhole/twisted}/ipaddrs.py | 0 src/{txwormhole => wormhole/twisted}/tor_manager.py | 0 src/{txwormhole => wormhole/twisted}/transcribe.py | 0 src/{txwormhole => wormhole/twisted}/transit.py | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename src/{txwormhole => wormhole/twisted}/__init__.py (100%) rename src/{txwormhole => wormhole/twisted}/eventsource.py (100%) rename src/{txwormhole => wormhole/twisted}/eventual.py (100%) rename src/{txwormhole => wormhole/twisted}/ipaddrs.py (100%) rename src/{txwormhole => wormhole/twisted}/tor_manager.py (100%) rename src/{txwormhole => wormhole/twisted}/transcribe.py (100%) rename src/{txwormhole => wormhole/twisted}/transit.py (100%) diff --git a/src/txwormhole/__init__.py b/src/wormhole/twisted/__init__.py similarity index 100% rename from src/txwormhole/__init__.py rename to src/wormhole/twisted/__init__.py diff --git a/src/txwormhole/eventsource.py b/src/wormhole/twisted/eventsource.py similarity index 100% rename from src/txwormhole/eventsource.py rename to src/wormhole/twisted/eventsource.py diff --git a/src/txwormhole/eventual.py b/src/wormhole/twisted/eventual.py similarity index 100% rename from src/txwormhole/eventual.py rename to src/wormhole/twisted/eventual.py diff --git a/src/txwormhole/ipaddrs.py b/src/wormhole/twisted/ipaddrs.py similarity index 100% rename from src/txwormhole/ipaddrs.py rename to src/wormhole/twisted/ipaddrs.py diff --git a/src/txwormhole/tor_manager.py b/src/wormhole/twisted/tor_manager.py similarity index 100% rename from src/txwormhole/tor_manager.py rename to src/wormhole/twisted/tor_manager.py diff --git a/src/txwormhole/transcribe.py b/src/wormhole/twisted/transcribe.py similarity index 100% rename from src/txwormhole/transcribe.py rename to src/wormhole/twisted/transcribe.py diff --git a/src/txwormhole/transit.py b/src/wormhole/twisted/transit.py similarity index 100% rename from src/txwormhole/transit.py rename to src/wormhole/twisted/transit.py From b2c3f49038bb391234cba38e7aa294759d387397 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 20 Apr 2016 19:11:29 -0700 Subject: [PATCH 09/10] unsplit txwormhole step 2: edit files --- setup.py | 2 +- src/wormhole/cli/cmd_receive.py | 6 +++--- src/wormhole/cli/cmd_send.py | 6 +++--- src/wormhole/test/common.py | 2 +- src/wormhole/test/test_interop.py | 2 +- src/wormhole/test/test_server.py | 2 +- src/wormhole/test/test_transit_twisted.py | 2 +- src/wormhole/test/test_twisted.py | 2 +- src/wormhole/twisted/__init__.py | 2 -- src/wormhole/twisted/tor_manager.py | 2 +- src/wormhole/twisted/transcribe.py | 8 ++++---- src/wormhole/twisted/transit.py | 4 ++-- 12 files changed, 19 insertions(+), 21 deletions(-) diff --git a/setup.py b/setup.py index 4a01c6a..650d472 100644 --- a/setup.py +++ b/setup.py @@ -15,7 +15,7 @@ setup(name="magic-wormhole", package_dir={"": "src"}, packages=["wormhole", "wormhole.blocking", - "txwormhole", + "wormhole.twisted", "wormhole.cli", "wormhole.server", "wormhole.test", diff --git a/src/wormhole/cli/cmd_receive.py b/src/wormhole/cli/cmd_receive.py index c4d03e4..14716dc 100644 --- a/src/wormhole/cli/cmd_receive.py +++ b/src/wormhole/cli/cmd_receive.py @@ -2,8 +2,8 @@ from __future__ import print_function import io, os, sys, json, binascii, six, tempfile, zipfile from twisted.internet import reactor, defer from twisted.internet.defer import inlineCallbacks, returnValue -from txwormhole.transcribe import Wormhole, WrongPasswordError -from txwormhole.transit import TransitReceiver +from ..twisted.transcribe import Wormhole, WrongPasswordError +from ..twisted.transit import TransitReceiver from ..errors import TransferError from .progress import ProgressPrinter @@ -33,7 +33,7 @@ class TwistedReceiver: tor_manager = None if self.args.tor: _start = self.args.timing.add_event("import TorManager") - from txwormhole.tor_manager import TorManager + from ..twisted.tor_manager import TorManager self.args.timing.finish_event(_start) tor_manager = TorManager(self._reactor, timing=self.args.timing) # For now, block everything until Tor has started. Soon: launch diff --git a/src/wormhole/cli/cmd_send.py b/src/wormhole/cli/cmd_send.py index e3faa4b..9e6fad1 100644 --- a/src/wormhole/cli/cmd_send.py +++ b/src/wormhole/cli/cmd_send.py @@ -5,8 +5,8 @@ from twisted.internet import reactor from twisted.internet.defer import inlineCallbacks, returnValue from ..errors import TransferError from .progress import ProgressPrinter -from txwormhole.transcribe import Wormhole, WrongPasswordError -from txwormhole.transit import TransitSender +from ..twisted.transcribe import Wormhole, WrongPasswordError +from ..twisted.transit import TransitSender APPID = u"lothar.com/wormhole/text-or-file-xfer" @@ -108,7 +108,7 @@ def send_twisted(args, reactor=reactor): tor_manager = None if args.tor: - from txwormhole.tor_manager import TorManager + from ..twisted.tor_manager import TorManager tor_manager = TorManager(reactor, timing=args.timing) # For now, block everything until Tor has started. Soon: launch tor # in parallel with everything else, make sure the TorManager can diff --git a/src/wormhole/test/common.py b/src/wormhole/test/common.py index bffa9c5..382cbfe 100644 --- a/src/wormhole/test/common.py +++ b/src/wormhole/test/common.py @@ -1,7 +1,7 @@ from twisted.application import service from twisted.internet import reactor, defer from twisted.python import log -from txwormhole.transit import allocate_tcp_port +from ..twisted.transit import allocate_tcp_port from ..server.server import RelayServer from .. import __version__ diff --git a/src/wormhole/test/test_interop.py b/src/wormhole/test/test_interop.py index f216a6e..23daa9c 100644 --- a/src/wormhole/test/test_interop.py +++ b/src/wormhole/test/test_interop.py @@ -2,7 +2,7 @@ from __future__ import print_function from twisted.trial import unittest from twisted.internet.defer import gatherResults from twisted.internet.threads import deferToThread -from txwormhole.transcribe import Wormhole as twisted_Wormhole +from ..twisted.transcribe import Wormhole as twisted_Wormhole from ..blocking.transcribe import Wormhole as blocking_Wormhole from .common import ServerBase diff --git a/src/wormhole/test/test_server.py b/src/wormhole/test/test_server.py index bd5f47f..16542e6 100644 --- a/src/wormhole/test/test_server.py +++ b/src/wormhole/test/test_server.py @@ -13,7 +13,7 @@ from autobahn.twisted import websocket from .. import __version__ from .common import ServerBase from ..server import rendezvous, transit_server -from txwormhole.eventsource import EventSource +from ..twisted.eventsource import EventSource class Reachable(ServerBase, unittest.TestCase): diff --git a/src/wormhole/test/test_transit_twisted.py b/src/wormhole/test/test_transit_twisted.py index 2a4e50d..4e4ea81 100644 --- a/src/wormhole/test/test_transit_twisted.py +++ b/src/wormhole/test/test_transit_twisted.py @@ -6,7 +6,7 @@ from twisted.internet import defer, task, endpoints, protocol, address, error from twisted.internet.defer import gatherResults, inlineCallbacks from twisted.python import log, failure from twisted.test import proto_helpers -from txwormhole import transit +from ..twisted import transit from ..errors import UsageError from nacl.secret import SecretBox from nacl.exceptions import CryptoError diff --git a/src/wormhole/test/test_twisted.py b/src/wormhole/test/test_twisted.py index a1e5f34..61b4dd5 100644 --- a/src/wormhole/test/test_twisted.py +++ b/src/wormhole/test/test_twisted.py @@ -2,7 +2,7 @@ from __future__ import print_function import json from twisted.trial import unittest from twisted.internet.defer import gatherResults, inlineCallbacks -from txwormhole.transcribe import Wormhole, UsageError, WrongPasswordError +from ..twisted.transcribe import Wormhole, UsageError, WrongPasswordError from .common import ServerBase APPID = u"appid" diff --git a/src/wormhole/twisted/__init__.py b/src/wormhole/twisted/__init__.py index 0ff5129..e69de29 100644 --- a/src/wormhole/twisted/__init__.py +++ b/src/wormhole/twisted/__init__.py @@ -1,2 +0,0 @@ -from wormhole import __version__ -__version__ # hush pyflakes diff --git a/src/wormhole/twisted/tor_manager.py b/src/wormhole/twisted/tor_manager.py index 30e8995..3545faa 100644 --- a/src/wormhole/twisted/tor_manager.py +++ b/src/wormhole/twisted/tor_manager.py @@ -8,7 +8,7 @@ from twisted.internet.error import ConnectError from twisted.web import iweb import txtorcon import ipaddr -from wormhole.timing import DebugTiming +from ..timing import DebugTiming from .transit import allocate_tcp_port # based on twisted.web.client._StandardEndpointFactory diff --git a/src/wormhole/twisted/transcribe.py b/src/wormhole/twisted/transcribe.py index 4750acd..3850724 100644 --- a/src/wormhole/twisted/transcribe.py +++ b/src/wormhole/twisted/transcribe.py @@ -10,10 +10,10 @@ from nacl.secret import SecretBox from nacl.exceptions import CryptoError from nacl import utils from spake2 import SPAKE2_Symmetric -from wormhole import __version__ -from wormhole import codes -from wormhole.errors import ServerError, Timeout, WrongPasswordError, UsageError -from wormhole.timing import DebugTiming +from .. import __version__ +from .. import codes +from ..errors import ServerError, Timeout, WrongPasswordError, UsageError +from ..timing import DebugTiming from hkdf import Hkdf def HKDF(skm, outlen, salt=None, CTXinfo=b""): diff --git a/src/wormhole/twisted/transit.py b/src/wormhole/twisted/transit.py index 70eb108..8d3d757 100644 --- a/src/wormhole/twisted/transit.py +++ b/src/wormhole/twisted/transit.py @@ -9,8 +9,8 @@ from twisted.internet.defer import inlineCallbacks, returnValue from twisted.protocols import policies from nacl.secret import SecretBox from hkdf import Hkdf -from wormhole.errors import UsageError -from wormhole.timing import DebugTiming +from ..errors import UsageError +from ..timing import DebugTiming from . import ipaddrs def HKDF(skm, outlen, salt=None, CTXinfo=b""): From 7b9c48fbc40b3cd7a5a4f9337d29eef7aa8e69d3 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 20 Apr 2016 19:18:31 -0700 Subject: [PATCH 10/10] unsplit: last fixups --- .coveragerc | 3 --- NEWS.md | 5 ----- setup.py | 2 +- 3 files changed, 1 insertion(+), 9 deletions(-) diff --git a/.coveragerc b/.coveragerc index 2e724d7..7f5f766 100644 --- a/.coveragerc +++ b/.coveragerc @@ -2,9 +2,6 @@ # only record trace data for wormhole.* source = wormhole - txwormhole - wormhole_cli - wormhole_server # and don't trace the test files themselves, or Versioneer's stuff omit = src/wormhole/test/* diff --git a/NEWS.md b/NEWS.md index 8473c63..f8baac7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -16,11 +16,6 @@ User-visible changes in "magic-wormhole": the CLI tool. * Twisted-flavor input_code() now does readline-based code entry, with tab completion. -* The code has been split into four separate importable packages: - * "wormhole", this contains the blocking library and shared code - * "txwormhole": twisted lbirary - * "wormhole_cli": CLI scripts - * "wormhole_server": code for the Rendezvous and Transit Relay servers * The package now installs two executables: "wormhole" (for send and receive), and "wormhole-server" (to start and manage the relay servers). diff --git a/setup.py b/setup.py index 650d472..95c90e5 100644 --- a/setup.py +++ b/setup.py @@ -15,10 +15,10 @@ setup(name="magic-wormhole", package_dir={"": "src"}, packages=["wormhole", "wormhole.blocking", - "wormhole.twisted", "wormhole.cli", "wormhole.server", "wormhole.test", + "wormhole.twisted", ], package_data={"wormhole.server": ["db-schemas/*.sql"]}, entry_points={"console_scripts":