diff options
-rw-r--r-- | scripts/reachx_cmd.py | 17 | ||||
-rw-r--r-- | src/python/abcpy_test.py | 2 |
2 files changed, 3 insertions, 16 deletions
diff --git a/scripts/reachx_cmd.py b/scripts/reachx_cmd.py index 0ed2876c..8461cb1d 100644 --- a/scripts/reachx_cmd.py +++ b/scripts/reachx_cmd.py @@ -43,18 +43,6 @@ def popen_and_wait_with_timeout(timeout,cmd, *args, **kwargs): return -1 @contextmanager -def replace_sys_argv(argv): - if 'argv' in sys.__dict__: - old_argv = sys.argv - sys.argv = argv - yield - sys.argv = old_argv - else: - sys.argv = argv - yield - del sys.argv - -@contextmanager def temp_file_name(suffix=""): file = tempfile.NamedTemporaryFile(delete=False, suffix=suffix) name = file.name @@ -105,13 +93,12 @@ def run_reachx_cmd(effort, timeout): def reachx_cmd(argv): usage = "usage: %prog [options]" - parser = optparse.OptionParser(usage) + parser = optparse.OptionParser(usage, prog="reachx") parser.add_option("-e", "--effort", dest="effort", type=int, default=0, help="effort level. [default=0, means unlimited]") parser.add_option("-t", "--timeout", dest="timeout", type=int, default=0, help="timeout in seconds [default=0, unlimited]") - with replace_sys_argv(argv): - options, args = parser.parse_args() + options, args = parser.parse_args(argv) rc = run_reachx_cmd(options.effort, options.timeout) print "%s command: jabc returned: %d"%(argv[0], rc) diff --git a/src/python/abcpy_test.py b/src/python/abcpy_test.py index 912cae9f..28c3505b 100644 --- a/src/python/abcpy_test.py +++ b/src/python/abcpy_test.py @@ -34,7 +34,7 @@ import optparse def pytest3_cmd(args): usage = "usage: %prog [options]" - parser = optparse.OptionParser(usage) + parser = optparse.OptionParser(usage, prog="pytest3") parser.add_option("-c", "--cmd", dest="cmd", help="command to ask help for") parser.add_option("-v", "--version", action="store_true", dest="version", help="display Python Version") |