Index: Misc/python.man =================================================================== --- Misc/python.man (revision 56970) +++ Misc/python.man (working copy) @@ -26,6 +26,9 @@ [ .B \-O ] +[ +.B \-q +] .br [ .B -Q @@ -128,6 +131,10 @@ .I .pyc to \fI.pyo\fP. Given twice, causes docstrings to be discarded. .TP +.B \-q +Do not print the version and copyright messages. These messages are +also suppressed in non-interactive mode. +.TP .BI "\-Q " argument Division control; see PEP 238. The argument must be one of "old" (the default, int/int and long/long return an int or long), "new" (new Index: Modules/main.c =================================================================== --- Modules/main.c (revision 56970) +++ Modules/main.c (working copy) @@ -40,7 +40,7 @@ static int orig_argc; /* command line options */ -#define BASE_OPTS "3c:dEhim:OQ:StuUvVW:xX?" +#define BASE_OPTS "3c:dEhim:OqQ:StuUvVW:xX?" #ifndef RISCOS #define PROGRAM_OPTS BASE_OPTS @@ -70,24 +70,27 @@ -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 : don't print version and copyright messages on interactive startup\n\ -Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew\n\ -S : don't imply 'import site' on initialization\n\ +"; +static char *usage_3 = "\ -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 = "\ 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\ +"; +static char *usage_4 = "\ -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\ -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\ +arg ...: arguments passed to program in sys.argv[1:]\n\n\ "; -static char *usage_4 = "\ -arg ...: arguments passed to program in sys.argv[1:]\n\n\ +static char *usage_5 = "\ Other environment variables:\n\ PYTHONSTARTUP: file executed on interactive startup (no default)\n\ PYTHONPATH : '%c'-separated list of directories prefixed to the\n\ @@ -110,7 +113,8 @@ fprintf(f, usage_1); fprintf(f, usage_2); fprintf(f, usage_3); - fprintf(f, usage_4, DELIM, DELIM, PYTHONHOMEHELP); + fprintf(f, usage_4); + fprintf(f, usage_5, DELIM, DELIM, PYTHONHOMEHELP); } #if defined(__VMS) if (exitcode == 0) { @@ -223,6 +227,7 @@ int help = 0; int version = 0; int saw_unbuffered_flag = 0; + int skip_intro = 0; /* option -q */ PyCompilerFlags cf; cf.cf_flags = 0; @@ -354,6 +359,10 @@ PySys_AddWarnOption(_PyOS_optarg); break; + case 'q': + skip_intro = 1; + break; + /* This space reserved for other options */ default: @@ -478,8 +487,9 @@ #endif Py_Initialize(); - if (Py_VerboseFlag || - (command == NULL && filename == NULL && module == NULL && stdin_is_interactive)) { + if (!skip_intro && (Py_VerboseFlag || + (command == NULL && filename == NULL && module == NULL + && stdin_is_interactive))) { fprintf(stderr, "Python %s on %s\n", Py_GetVersion(), Py_GetPlatform()); if (!Py_NoSiteFlag)