diff options
author | Georg Brandl <georg@python.org> | 2008-01-07 17:09:35 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-01-07 17:09:35 (GMT) |
commit | 2da0fceba7dd70334aacbab0708a8cbdff92e31d (patch) | |
tree | f93838b60f3c3216db03eaa24b32f4dc92389230 /Modules/main.c | |
parent | b3255ed8c937510076b641db28ab052ddaee1178 (diff) | |
download | cpython-2da0fceba7dd70334aacbab0708a8cbdff92e31d.zip cpython-2da0fceba7dd70334aacbab0708a8cbdff92e31d.tar.gz cpython-2da0fceba7dd70334aacbab0708a8cbdff92e31d.tar.bz2 |
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Diffstat (limited to 'Modules/main.c')
-rw-r--r-- | Modules/main.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/Modules/main.c b/Modules/main.c index 26f8780..71c9c59 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -40,7 +40,7 @@ static char **orig_argv; static int orig_argc; /* command line options */ -#define BASE_OPTS "3c:dEhim:OQ:StuUvVW:xX?" +#define BASE_OPTS "3Bc:dEhim:OQ:StuUvVW:xX?" #ifndef RISCOS #define PROGRAM_OPTS BASE_OPTS @@ -59,39 +59,42 @@ static char *usage_line = /* Long usage message, split into parts < 512 bytes */ static char *usage_1 = "\ Options and arguments (and corresponding environment variables):\n\ +-B : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x\n\ -c cmd : program passed in as string (terminates option list)\n\ -d : debug output from parser; also PYTHONDEBUG=x\n\ -E : ignore environment variables (such as PYTHONPATH)\n\ -h : print this help message and exit (also --help)\n\ -i : inspect interactively after running script; forces a prompt even\n\ - if stdin does not appear to be a terminal; also PYTHONINSPECT=x\n\ "; static char *usage_2 = "\ + if stdin does not appear to be a terminal; also PYTHONINSPECT=x\n\ -m mod : run library module as a script (terminates option list)\n\ -O : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x\n\ -OO : remove doc-strings in addition to the -O optimizations\n\ -Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew\n\ -S : don't imply 'import site' on initialization\n\ -t : issue warnings about inconsistent tab usage (-tt: issue errors)\n\ --u : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x\n\ "; static char *usage_3 = "\ +-u : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x\n\ see man page for details on internal buffering relating to '-u'\n\ -v : verbose (trace import statements); also PYTHONVERBOSE=x\n\ can be supplied multiple times to increase verbosity\n\ -V : print the Python version number and exit (also --version)\n\ -W arg : warning control; arg is action:message:category:module:lineno\n\ -x : skip first line of source, allowing use of non-Unix forms of #!cmd\n\ +"; +static char *usage_4 = "\ -3 : warn about Python 3.x incompatibilities\n\ file : program read from script file\n\ - : program read from stdin (default; interactive mode if a tty)\n\ -"; -static char *usage_4 = "\ arg ...: arguments passed to program in sys.argv[1:]\n\n\ Other environment variables:\n\ PYTHONSTARTUP: file executed on interactive startup (no default)\n\ PYTHONPATH : '%c'-separated list of directories prefixed to the\n\ default module search path. The result is sys.path.\n\ +"; +static char *usage_5 = "\ PYTHONHOME : alternate <prefix> directory (or <prefix>%c<exec_prefix>).\n\ The default module search path uses %s.\n\ PYTHONCASEOK : ignore case in 'import' statements (Windows).\n\ @@ -110,7 +113,8 @@ usage(int exitcode, char* program) fprintf(f, usage_1); fprintf(f, usage_2); fprintf(f, usage_3); - fprintf(f, usage_4, DELIM, DELIM, PYTHONHOMEHELP); + fprintf(f, usage_4, DELIM); + fprintf(f, usage_5, DELIM, PYTHONHOMEHELP); } #if defined(__VMS) if (exitcode == 0) { @@ -337,6 +341,10 @@ Py_Main(int argc, char **argv) Py_OptimizeFlag++; break; + case 'B': + Py_DontWriteBytecodeFlag++; + break; + case 'S': Py_NoSiteFlag++; break; |