diff options
author | 2013-02-10 16:54:52 -0500 | |
---|---|---|
committer | 2013-02-10 16:54:52 -0500 | |
commit | 5e92c9dfc70f3a6e326d64264813876b034a3f88 (patch) | |
tree | c58479fa3731e4964a5000dd55ff1a1d2d80ee0e | |
parent | support testing env values passed to app_main, test supported vars (diff) | |
download | pypy-5e92c9dfc70f3a6e326d64264813876b034a3f88.tar.gz pypy-5e92c9dfc70f3a6e326d64264813876b034a3f88.tar.bz2 pypy-5e92c9dfc70f3a6e326d64264813876b034a3f88.zip |
app_main support a few more args/env vars
-rwxr-xr-x | pypy/interpreter/app_main.py | 13 | ||||
-rw-r--r-- | pypy/interpreter/test2/test_app_main.py | 7 |
2 files changed, 14 insertions, 6 deletions
diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py index 87b491b63d..d4557e3366 100755 --- a/pypy/interpreter/app_main.py +++ b/pypy/interpreter/app_main.py @@ -355,6 +355,7 @@ cmdline_options = { '3': (simple_option, 'py3k_warning'), # more complex options 'c': (c_option, Ellipsis), + '?': (print_help, None), 'h': (print_help, None), '--help': (print_help, None), 'm': (m_option, Ellipsis), @@ -426,12 +427,16 @@ def parse_command_line(argv): sys.argv[:] = argv if not options["ignore_environment"]: - if os.getenv('PYTHONUNBUFFERED'): - options["unbuffered"] = 1 - if os.getenv('PYTHONNOUSERSITE'): - options["no_user_site"] = 1 + if os.getenv('PYTHONDEBUG'): + options["debug"] = 1 if os.getenv('PYTHONDONTWRITEBYTECODE'): options["dont_write_bytecode"] = 1 + if os.getenv('PYTHONNOUSERSITE'): + options["no_user_site"] = 1 + if os.getenv('PYTHONUNBUFFERED'): + options["unbuffered"] = 1 + if os.getenv('PYTHONVERBOSE'): + options["verbose"] = 1 if (options["interactive"] or (not options["ignore_environment"] and os.getenv('PYTHONINSPECT'))): diff --git a/pypy/interpreter/test2/test_app_main.py b/pypy/interpreter/test2/test_app_main.py index bada5862da..902ef24f5c 100644 --- a/pypy/interpreter/test2/test_app_main.py +++ b/pypy/interpreter/test2/test_app_main.py @@ -124,6 +124,7 @@ class TestParseCommandLine: no_site=1, optimize=1, division_new=1) self.check(['-i'], {}, sys_argv=[''], run_stdin=True, interactive=1, inspect=1) + self.check(['-?'], {}, output_contains='usage:') self.check(['-h'], {}, output_contains='usage:') self.check(['-S', '-tO', '-h'], {}, output_contains='usage:') self.check(['-S', '-thO'], {}, output_contains='usage:') @@ -160,9 +161,11 @@ class TestParseCommandLine: self.check(['-W', 'ab', '-SWc'], {}, sys_argv=[''], warnoptions=['ab', 'c'], run_stdin=True, no_site=1) - self.check([], {'PYTHONUNBUFFERED': '1'}, sys_argv=[''], run_stdin=True, unbuffered=1) - self.check([], {'PYTHONNOUSERSITE': '1'}, sys_argv=[''], run_stdin=True, no_user_site=1) + self.check([], {'PYTHONDEBUG': '1'}, sys_argv=[''], run_stdin=True, debug=1) self.check([], {'PYTHONDONTWRITEBYTECODE': '1'}, sys_argv=[''], run_stdin=True, dont_write_bytecode=1) + self.check([], {'PYTHONNOUSERSITE': '1'}, sys_argv=[''], run_stdin=True, no_user_site=1) + self.check([], {'PYTHONUNBUFFERED': '1'}, sys_argv=[''], run_stdin=True, unbuffered=1) + self.check([], {'PYTHONVERBOSE': '1'}, sys_argv=[''], run_stdin=True, verbose=1) def test_sysflags(self): flags = ( |