Author: David Schneider <david.schnei...@picle.org> Branch: Changeset: r63794:6fc3fb8cd5cc Date: 2013-05-01 23:31 +0200 http://bitbucket.org/pypy/pypy/changeset/6fc3fb8cd5cc/
Log: merge heads diff --git a/pypy/interpreter/app_main.py b/pypy/interpreter/app_main.py --- a/pypy/interpreter/app_main.py +++ b/pypy/interpreter/app_main.py @@ -1,20 +1,40 @@ #! /usr/bin/env python # App-level version of py.py. # See test/test_app_main. + +# Missing vs CPython: -d, -OO, -t, -v, -x, -3 +"""\ +Options and arguments (and corresponding environment variables): +-B : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x +-c cmd : program passed in as string (terminates option list) +-E : ignore PYTHON* environment variables (such as PYTHONPATH) +-h : print this help message and exit (also --help) +-i : inspect interactively after running script; forces a prompt even + if stdin does not appear to be a terminal; also PYTHONINSPECT=x +-m mod : run library module as a script (terminates option list) +-O : dummy optimization flag for compatibility with CPython +-R : ignored (see http://bugs.python.org/issue14621) +-Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew +-s : don't add user site directory to sys.path; also PYTHONNOUSERSITE +-S : don't imply 'import site' on initialization +-u : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x +-V : print the Python version number and exit (also --version) +-W arg : warning control; arg is action:message:category:module:lineno + also PYTHONWARNINGS=arg +file : program read from script file +- : program read from stdin (default; interactive mode if a tty) +arg ...: arguments passed to program in sys.argv[1:] +PyPy options and arguments: +--info : print translation information about this PyPy executable """ -options: - -i inspect interactively after running script - -O dummy optimization flag for compatibility with C Python - -c cmd program passed in as CMD (terminates option list) - -S do not 'import site' on initialization - -u unbuffered binary stdout and stderr - -h, --help show this help message and exit - -m mod library module to be run as a script (terminates option list) - -W arg warning control (arg is action:message:category:module:lineno) - -E ignore environment variables (such as PYTHONPATH) - -R ignored (see http://bugs.python.org/issue14621) - --version print the PyPy version - --info print translation information about this PyPy executable +USAGE1 = __doc__ +# Missing vs CPython: PYTHONHOME, PYTHONCASEOK +USAGE2 = """ +Other environment variables: +PYTHONSTARTUP: file executed on interactive startup (no default) +PYTHONPATH : %r-separated list of directories prefixed to the + default module search path. The result is sys.path. +PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr. """ import sys @@ -136,12 +156,13 @@ raise SystemExit def print_help(*args): - print 'usage: %s [options] [-c cmd|-m mod|file.py|-] [arg...]' % ( + import os + print 'usage: %s [option] ... [-c cmd | -m mod | file | -] [arg] ...' % ( sys.executable,) - print __doc__.rstrip() + print USAGE1, if 'pypyjit' in sys.builtin_module_names: - print " --jit OPTIONS advanced JIT options: try 'off' or 'help'" - print + print "--jit options: advanced JIT options: try 'off' or 'help'" + print (USAGE2 % (os.pathsep,)), raise SystemExit def _print_jit_help(): diff --git a/pypy/interpreter/test2/test_app_main.py b/pypy/interpreter/test2/test_app_main.py --- a/pypy/interpreter/test2/test_app_main.py +++ b/pypy/interpreter/test2/test_app_main.py @@ -264,7 +264,8 @@ # test that -h prints the usage, including the name of the executable # which should be /full/path/to/app_main.py in this case child = self.spawn(['-h']) - child.expect(r'usage: .*app_main.py \[options\]') + child.expect(r'usage: .*app_main.py \[option\]') + child.expect('PyPy options and arguments:') def test_run_script(self): child = self.spawn([demo_script]) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit