From 4e3f0892574aab4cc14916c01fb51b818430f3be Mon Sep 17 00:00:00 2001 From: robk-tahoe Date: Tue, 8 Jan 2008 19:51:18 -0700 Subject: [PATCH] tweak running to make node start/stop code optional add a 'install_node_control' flag to runner.run(), default True this enables the start/stop node commands which are not too useful on windows --- src/allmydata/scripts/runner.py | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/allmydata/scripts/runner.py b/src/allmydata/scripts/runner.py index b39e5b48..fe51dc38 100644 --- a/src/allmydata/scripts/runner.py +++ b/src/allmydata/scripts/runner.py @@ -6,21 +6,32 @@ from twisted.python import usage from allmydata.scripts.common import BaseOptions import debug, create_node, startstop_node, cli +_general_commands = create_node.subCommands + debug.subCommands + cli.subCommands + class Options(BaseOptions, usage.Options): synopsis = "Usage: tahoe [command options]" subCommands = [] - subCommands += create_node.subCommands + subCommands += _general_commands subCommands += startstop_node.subCommands - subCommands += debug.subCommands - subCommands += cli.subCommands def postOptions(self): if not hasattr(self, 'subOptions'): raise usage.UsageError("must specify a command") -def runner(argv, run_by_human=True, stdout=sys.stdout, stderr=sys.stderr): - config = Options() +class OptionsNoNodeControl(Options): + synopsis = "Usage: tahoe [command options]" + + subCommands = [] + subCommands += _general_commands + + +def runner(argv, run_by_human=True, stdout=sys.stdout, stderr=sys.stderr, + install_node_control=True): + if install_node_control: + config = Options() + else: + config = OptionsNoNodeControl() try: config.parseOptions(argv) except usage.error, e: @@ -54,6 +65,6 @@ def runner(argv, run_by_human=True, stdout=sys.stdout, stderr=sys.stderr): return rc -def run(): +def run(install_node_control=True): rc = runner(sys.argv[1:]) sys.exit(rc) -- 2.45.2