[Python-checkins] CVS: python/dist/src/Python frozenmain.c,2.25,2.26 import.c,2.179,2.180 pythonrun.c,2.138,2.139

Neil Schemenauer nascheme@users.sourceforge.net
Mon, 23 Jul 2001 09:30:29 -0700


Update of /cvsroot/python/python/dist/src/Python
In directory usw-pr-cvs1:/tmp/cvs-serv25036/Python

Modified Files:
	frozenmain.c import.c pythonrun.c 
Log Message:
Add -E command line switch (ignore environment variables like PYTHONHOME
and PYTHONPATH).


Index: frozenmain.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/frozenmain.c,v
retrieving revision 2.25
retrieving revision 2.26
diff -C2 -d -r2.25 -r2.26
*** frozenmain.c	2000/09/01 23:29:28	2.25
--- frozenmain.c	2001/07/23 16:30:27	2.26
***************
*** 31,37 ****
  	Py_FrozenFlag = 1; /* Suppress errors from getpath.c */
  
! 	if ((p = getenv("PYTHONINSPECT")) && *p != '\0')
  		inspect = 1;
! 	if ((p = getenv("PYTHONUNBUFFERED")) && *p != '\0')
  		unbuffered = 1;
  
--- 31,37 ----
  	Py_FrozenFlag = 1; /* Suppress errors from getpath.c */
  
! 	if ((p = Py_GETENV("PYTHONINSPECT")) && *p != '\0')
  		inspect = 1;
! 	if ((p = Py_GETENV("PYTHONUNBUFFERED")) && *p != '\0')
  		unbuffered = 1;
  

Index: import.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/import.c,v
retrieving revision 2.179
retrieving revision 2.180
diff -C2 -d -r2.179 -r2.180
*** import.c	2001/07/23 13:27:49	2.179
--- import.c	2001/07/23 16:30:27	2.180
***************
*** 1070,1074 ****
  #endif
  
! 	if (getenv("PYTHONCASEOK") != NULL)
  		return 1;
  
--- 1070,1074 ----
  #endif
  
! 	if (Py_GETENV("PYTHONCASEOK") != NULL)
  		return 1;
  
***************
*** 1093,1097 ****
  	int done;
  
! 	if (getenv("PYTHONCASEOK") != NULL)
  		return 1;
  
--- 1093,1097 ----
  	int done;
  
! 	if (Py_GETENV("PYTHONCASEOK") != NULL)
  		return 1;
  
***************
*** 1110,1114 ****
  	OSErr err;
  
! 	if (getenv("PYTHONCASEOK") != NULL)
  		return 1;
  
--- 1110,1114 ----
  	OSErr err;
  
! 	if (Py_GETENV("PYTHONCASEOK") != NULL)
  		return 1;
  
***************
*** 1148,1152 ****
  	const int dirlen = len - namelen - 1; /* don't want trailing SEP */
  
! 	if (getenv("PYTHONCASEOK") != NULL)
  		return 1;
  
--- 1148,1152 ----
  	const int dirlen = len - namelen - 1; /* don't want trailing SEP */
  
! 	if (Py_GETENV("PYTHONCASEOK") != NULL)
  		return 1;
  

Index: pythonrun.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Python/pythonrun.c,v
retrieving revision 2.138
retrieving revision 2.139
diff -C2 -d -r2.138 -r2.139
*** pythonrun.c	2001/07/16 16:51:33	2.138
--- pythonrun.c	2001/07/23 16:30:27	2.139
***************
*** 64,67 ****
--- 64,68 ----
  int Py_FrozenFlag; /* Needed by getpath.c */
  int Py_UnicodeFlag = 0; /* Needed by compile.c */
+ int Py_IgnoreEnvironmentFlag; /* e.g. PYTHONPATH, PYTHONHOME */
  
  static int initialized = 0;
***************
*** 99,107 ****
  	initialized = 1;
  	
! 	if ((p = getenv("PYTHONDEBUG")) && *p != '\0')
  		Py_DebugFlag = Py_DebugFlag ? Py_DebugFlag : 1;
! 	if ((p = getenv("PYTHONVERBOSE")) && *p != '\0')
  		Py_VerboseFlag = Py_VerboseFlag ? Py_VerboseFlag : 1;
! 	if ((p = getenv("PYTHONOPTIMIZE")) && *p != '\0')
  		Py_OptimizeFlag = Py_OptimizeFlag ? Py_OptimizeFlag : 1;
  
--- 100,108 ----
  	initialized = 1;
  	
! 	if ((p = Py_GETENV("PYTHONDEBUG")) && *p != '\0')
  		Py_DebugFlag = Py_DebugFlag ? Py_DebugFlag : 1;
! 	if ((p = Py_GETENV("PYTHONVERBOSE")) && *p != '\0')
  		Py_VerboseFlag = Py_VerboseFlag ? Py_VerboseFlag : 1;
! 	if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0')
  		Py_OptimizeFlag = Py_OptimizeFlag ? Py_OptimizeFlag : 1;
  
***************
*** 226,230 ****
  	if (
  #ifdef MS_WINDOWS /* Only ask on Windows if env var set */
! 	    getenv("PYTHONDUMPREFS") &&
  #endif /* MS_WINDOWS */
  	    _Py_AskYesNo("Print left references?")) {
--- 227,231 ----
  	if (
  #ifdef MS_WINDOWS /* Only ask on Windows if env var set */
! 	    Py_GETENV("PYTHONDUMPREFS") &&
  #endif /* MS_WINDOWS */
  	    _Py_AskYesNo("Print left references?")) {
***************
*** 395,400 ****
  {
  	char *home = default_home;
! 	if (home == NULL)
! 		home = getenv("PYTHONHOME");
  	return home;
  }
--- 396,401 ----
  {
  	char *home = default_home;
! 	if (home == NULL && !Py_IgnoreEnvironmentFlag)
! 		home = Py_GETENV("PYTHONHOME");
  	return home;
  }