From 6889ba088c3df2cee47a9c3f8f671a2f7bc210b5 Mon Sep 17 00:00:00 2001 From: Brian Warner Date: Wed, 22 Feb 2017 17:08:08 -0800 Subject: [PATCH] remove server/runner.py, no longer used --- src/wormhole/server/cli.py | 2 +- src/wormhole/server/runner.py | 62 ----------------------------------- 2 files changed, 1 insertion(+), 63 deletions(-) delete mode 100644 src/wormhole/server/runner.py diff --git a/src/wormhole/server/cli.py b/src/wormhole/server/cli.py index 5398da7..8279e10 100644 --- a/src/wormhole/server/cli.py +++ b/src/wormhole/server/cli.py @@ -9,7 +9,7 @@ import click #@wormhole.group() @click.group() @click.pass_context -def server(ctx): +def server(ctx): # this is the setuptools entrypoint for bin/wormhole-server """ Control a relay server (most users shouldn't need to worry about this and can use the default server). diff --git a/src/wormhole/server/runner.py b/src/wormhole/server/runner.py deleted file mode 100644 index d8247d4..0000000 --- a/src/wormhole/server/runner.py +++ /dev/null @@ -1,62 +0,0 @@ -from __future__ import print_function, unicode_literals -import os, sys -from .cli_args import parser - -def dispatch(args): - if args.func == "server/start": - from . import cmd_server - return cmd_server.start_server(args) - if args.func == "server/stop": - from . import cmd_server - return cmd_server.stop_server(args) - if args.func == "server/restart": - from . import cmd_server - return cmd_server.restart_server(args) - if args.func == "usage/usage": - from . import cmd_usage - return cmd_usage.show_usage(args) - if args.func == "usage/tail": - from . import cmd_usage - return cmd_usage.tail_usage(args) - if args.func == "usage/count-channels": - from . import cmd_usage - return cmd_usage.count_channels(args) - if args.func == "usage/count-events": - from . import cmd_usage - return cmd_usage.count_events(args) - - raise ValueError("unknown args.func %s" % args.func) - -def run(args, cwd, stdout, stderr, executable=None): - """This is invoked directly by the 'wormhole-server' entry-point script. - It can also invoked by entry() below.""" - - args = parser.parse_args() - if not getattr(args, "func", None): - # So far this only works on py3. py2 exits with a really terse - # "error: too few arguments" during parse_args(). - parser.print_help() - sys.exit(0) - args.cwd = cwd - args.stdout = stdout - args.stderr = stderr - - try: - rc = dispatch(args) - return rc - except ImportError as e: - print("--- ImportError ---", file=stderr) - print(e, file=stderr) - print("Please run 'python setup.py build'", file=stderr) - raise - return 1 - -def entry(): - """This is used by a setuptools entry_point. When invoked this way, - setuptools has already put the installed package on sys.path .""" - return run(sys.argv[1:], os.getcwd(), sys.stdout, sys.stderr, - executable=sys.argv[0]) - -if __name__ == "__main__": - args = parser.parse_args() - print(args)