[Python-checkins] python/dist/src/Lib site.py,1.46,1.47

jvr@users.sourceforge.net jvr@users.sourceforge.net
Mon, 30 Dec 2002 14:08:35 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv32400/Lib

Modified Files:
	site.py 
Log Message:
PEP 302 + zipimport:
- new import hooks in import.c, exposed in the sys module
- new module called 'zipimport'
- various changes to allow bootstrapping from zip files

I hope I didn't break the Windows build (or anything else for that
matter), but then again, it's been sitting on sf long enough...

Regarding the latest discussions on python-dev: zipimport sets
pkg.__path__ as specified in PEP 273, and likewise, sys.path item such as
/path/to/Archive.zip/subdir/ are supported again.


Index: site.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/site.py,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** site.py	9 Nov 2002 05:08:06 -0000	1.46
--- site.py	30 Dec 2002 22:08:02 -0000	1.47
***************
*** 74,87 ****
  L = []
  _dirs_in_sys_path = {}
  for dir in sys.path:
!     # Filter out paths that don't exist, but leave in the empty string
!     # since it's a special case. We also need to special-case the Mac,
!     # as file names are allowed on sys.path there.
!     if sys.platform != 'mac':
!         if dir and not os.path.isdir(dir):
!             continue
!     else:
!         if dir and not os.path.exists(dir):
!             continue
      dir, dircase = makepath(dir)
      if not dircase in _dirs_in_sys_path:
--- 74,82 ----
  L = []
  _dirs_in_sys_path = {}
+ dir = dircase = None  # sys.path may be empty at this point
  for dir in sys.path:
!     # Filter out duplicate paths (on case-insensitive file systems also
!     # if they only differ in case); turn relative paths into absolute
!     # paths.
      dir, dircase = makepath(dir)
      if not dircase in _dirs_in_sys_path: