From 8dc226fccd2183670ac19a85b89941f5b05167dc Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Tue, 6 May 2008 23:45:46 +0000 Subject: Merged revisions 62774-62775,62785,62787-62788 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r62774 | georg.brandl | 2008-05-06 19:11:42 +0200 (Tue, 06 May 2008) | 2 lines #2773: fix description of 'g' and 'G' formatting spec. ........ r62775 | georg.brandl | 2008-05-06 19:20:54 +0200 (Tue, 06 May 2008) | 2 lines > != (!<). ........ r62785 | benjamin.peterson | 2008-05-07 00:18:11 +0200 (Wed, 07 May 2008) | 2 lines Fix logic error in Python/_warnings.c and add a test to verify ........ r62787 | benjamin.peterson | 2008-05-07 00:31:52 +0200 (Wed, 07 May 2008) | 2 lines Make the Python implementation of warnings compatible with the C implementation regarding non-callable showwarning ........ r62788 | christian.heimes | 2008-05-07 00:41:46 +0200 (Wed, 07 May 2008) | 1 line Implemented PEP 370 ........ --- Modules/main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Modules/main.c') diff --git a/Modules/main.c b/Modules/main.c index 0fd59c9871..27b8493941 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -45,7 +45,7 @@ static wchar_t **orig_argv; static int orig_argc; /* command line options */ -#define BASE_OPTS L"bBc:dEhiJm:OStuvVW:xX?" +#define BASE_OPTS L"bBc:dEhiJm:OsStuvVW:xX?" #define PROGRAM_OPTS BASE_OPTS @@ -70,6 +70,7 @@ static char *usage_2 = "\ -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\ +-s : don't add user site directory to sys.path; also PYTHONNOUSERSITE\n\ -S : don't imply 'import site' on initialization\n\ -t : issue warnings about inconsistent tab usage (-tt: issue errors)\n\ "; @@ -355,6 +356,10 @@ Py_Main(int argc, wchar_t **argv) Py_DontWriteBytecodeFlag++; break; + case 's': + Py_NoUserSiteDirectory++; + break; + case 'S': Py_NoSiteFlag++; break; @@ -419,6 +424,10 @@ Py_Main(int argc, wchar_t **argv) (p = Py_GETENV("PYTHONUNBUFFERED")) && *p != '\0') unbuffered = 1; + if (!Py_NoUserSiteDirectory && + (p = Py_GETENV("PYTHONNOUSERSITE")) && *p != '\0') + Py_NoUserSiteDirectory = 1; + if (command == NULL && module == NULL && _PyOS_optind < argc && wcscmp(argv[_PyOS_optind], L"-") != 0) { -- cgit v1.2.1