[Python-checkins] CVS: python/dist/src/Modules getpath.c,1.35,1.36 main.c,1.55,1.56 timemodule.c,2.111,2.112
Neil Schemenauer
nascheme@users.sourceforge.net
Mon, 23 Jul 2001 09:30:29 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv25036/Modules
Modified Files:
getpath.c main.c timemodule.c
Log Message:
Add -E command line switch (ignore environment variables like PYTHONHOME
and PYTHONPATH).
Index: getpath.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/getpath.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -C2 -d -r1.35 -r1.36
*** getpath.c 2001/01/24 17:13:11 1.35
--- getpath.c 2001/07/23 16:30:27 1.36
***************
*** 366,370 ****
static char separator[2] = {SEP, '\0'};
char *pythonpath = PYTHONPATH;
! char *rtpypath = getenv("PYTHONPATH");
char *home = Py_GetPythonHome();
char *path = getenv("PATH");
--- 366,370 ----
static char separator[2] = {SEP, '\0'};
char *pythonpath = PYTHONPATH;
! char *rtpypath = Py_GETENV("PYTHONPATH");
char *home = Py_GetPythonHome();
char *path = getenv("PATH");
Index: main.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/main.c,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -d -r1.55 -r1.56
*** main.c 2001/07/18 16:59:46 1.55
--- main.c 2001/07/23 16:30:27 1.56
***************
*** 29,33 ****
/* command line options */
! #define BASE_OPTS "c:diOStuUvxXhVW:"
#ifndef RISCOS
--- 29,33 ----
/* command line options */
! #define BASE_OPTS "c:diOSEtuUvxXhVW:"
#ifndef RISCOS
***************
*** 54,57 ****
--- 54,58 ----
-OO : remove doc-strings in addition to the -O optimizations\n\
-S : don't imply 'import site' on initialization\n\
+ -E : ignore environment variables (such as PYTHONPATH)\n\
-t : issue warnings about inconsistent tab usage (-tt: issue errors)\n\
";
***************
*** 109,112 ****
--- 110,115 ----
int help = 0;
int version = 0;
+ int saw_inspect_flag = 0;
+ int saw_unbuffered_flag = 0;
PyCompilerFlags cf;
***************
*** 118,126 ****
#endif
- if ((p = getenv("PYTHONINSPECT")) && *p != '\0')
- inspect = 1;
- if ((p = getenv("PYTHONUNBUFFERED")) && *p != '\0')
- unbuffered = 1;
-
PySys_ResetWarnOptions();
--- 121,124 ----
***************
*** 147,150 ****
--- 145,149 ----
case 'i':
inspect++;
+ saw_inspect_flag = 1;
Py_InteractiveFlag++;
break;
***************
*** 158,161 ****
--- 157,164 ----
break;
+ case 'E':
+ Py_IgnoreEnvironmentFlag++;
+ break;
+
case 't':
Py_TabcheckFlag++;
***************
*** 164,167 ****
--- 167,171 ----
case 'u':
unbuffered++;
+ saw_unbuffered_flag = 1;
break;
***************
*** 211,214 ****
--- 215,225 ----
}
+ if (!saw_inspect_flag &&
+ (p = Py_GETENV("PYTHONINSPECT")) && *p != '\0')
+ inspect = 1;
+ if (!saw_unbuffered_flag &&
+ (p = Py_GETENV("PYTHONUNBUFFERED")) && *p != '\0')
+ unbuffered = 1;
+
if (command == NULL && _PyOS_optind < argc &&
strcmp(argv[_PyOS_optind], "-") != 0)
***************
*** 308,312 ****
else {
if (filename == NULL && stdin_is_interactive) {
! char *startup = getenv("PYTHONSTARTUP");
if (startup != NULL && startup[0] != '\0') {
FILE *fp = fopen(startup, "r");
--- 319,323 ----
else {
if (filename == NULL && stdin_is_interactive) {
! char *startup = Py_GETENV("PYTHONSTARTUP");
if (startup != NULL && startup[0] != '\0') {
FILE *fp = fopen(startup, "r");
Index: timemodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/timemodule.c,v
retrieving revision 2.111
retrieving revision 2.112
diff -C2 -d -r2.111 -r2.112
*** timemodule.c 2001/05/14 22:32:33 2.111
--- timemodule.c 2001/07/23 16:30:27 2.112
***************
*** 595,599 ****
d = PyModule_GetDict(m);
/* Accept 2-digit dates unless PYTHONY2K is set and non-empty */
! p = getenv("PYTHONY2K");
ins(d, "accept2dyear", PyInt_FromLong((long) (!p || !*p)));
/* Squirrel away the module's dictionary for the y2k check */
--- 595,599 ----
d = PyModule_GetDict(m);
/* Accept 2-digit dates unless PYTHONY2K is set and non-empty */
! p = Py_GETENV("PYTHONY2K");
ins(d, "accept2dyear", PyInt_FromLong((long) (!p || !*p)));
/* Squirrel away the module's dictionary for the y2k check */