Add support to bin/tahoe for invoking a runner command prefixed with @, with the Tahoe libraries on the PYTHONPATH. This is documented in 'tahoe debug --help'.

This commit is contained in:
david-sarah 2011-01-18 21:11:37 -08:00
parent 74b1eec1d6
commit 3798d9946e
2 changed files with 32 additions and 2 deletions

View File

@ -95,7 +95,22 @@ when you run "python setup.py install" (perhaps as "%s").
''' % (script, perhaps_installed_tahoe)
sys.exit(1)
command = prefix + [script] + args
# Support indirection via another "runner" script (e.g. coverage).
# For example: bin/tahoe @RUNNER RUNNER_ARGS @tahoe TAHOE_ARGS
if len(args) >= 1 and args[0].startswith('@'):
runner = args[0][1:]
if runner.endswith('.py') or runner.endswith('.pyscript'):
prefix = [sys.executable]
else:
prefix = []
def _subst(a):
if a == '@tahoe': return script
return a
command = prefix + [runner] + map(_subst, args[1:])
else:
command = prefix + [script] + args
try:
res = subprocess.call(command, env=os.environ)

View File

@ -846,7 +846,22 @@ Subcommands:
Please run e.g. 'tahoe debug dump-share --help' for more details on each
subcommand.
"""
Another debugging feature is that bin%stahoe allows executing an arbitrary
"runner" command (typically an installed Python script, such as 'coverage'),
with the Tahoe libraries on the PYTHONPATH. The runner command name is
prefixed with '@', and any occurrences of '@tahoe' in its arguments are
replaced by the full path to the tahoe script.
For example, if 'coverage' is installed and on the PATH, you can use:
bin%stahoe @coverage run --branch @tahoe debug trial
to get branch coverage for the Tahoe test suite. Or, to run python with
the -3 option that warns about Python 3 incompatibilities:
bin%stahoe @python -3 @tahoe command [options]
""" % (os.sep, os.sep, os.sep)
return t
subDispatch = {