[Python-checkins] r57535 - sandbox/trunk/import_in_py/zipimport_/tests.py sandbox/trunk/import_in_py/zipimport_/zipimport.py
brett.cannon
python-checkins at python.org
Mon Aug 27 02:33:46 CEST 2007
Author: brett.cannon
Date: Mon Aug 27 02:33:46 2007
New Revision: 57535
Modified:
sandbox/trunk/import_in_py/zipimport_/tests.py
sandbox/trunk/import_in_py/zipimport_/zipimport.py
Log:
Remove need to have prefix end with the path separator. Seems like it was
imposed more to ease the C code than for any other reason.
Modified: sandbox/trunk/import_in_py/zipimport_/tests.py
==============================================================================
--- sandbox/trunk/import_in_py/zipimport_/tests.py (original)
+++ sandbox/trunk/import_in_py/zipimport_/tests.py Mon Aug 27 02:33:46 2007
@@ -94,7 +94,7 @@
# Thanks to __path__, need to be able to work off of a path with a zip
# file at the front and a path for the rest.
with temp_zipfile() as zip_path:
- prefix = os.path.join('_pkg', '')
+ prefix = '_pkg'
path = os.path.join(zip_path, prefix)
zip_importer = zipimport.zipimporter(path)
self.assert_(isinstance(zip_importer, zipimport.zipimporter))
Modified: sandbox/trunk/import_in_py/zipimport_/zipimport.py
==============================================================================
--- sandbox/trunk/import_in_py/zipimport_/zipimport.py (original)
+++ sandbox/trunk/import_in_py/zipimport_/zipimport.py Mon Aug 27 02:33:46 2007
@@ -42,9 +42,8 @@
else:
raise ZipImportError("%s is not a zip file" % archivepath)
self.archive = path # Path to zip file.
+ # XXX C version guarantees 'prefix' ends in a path separator.
self.prefix = archivepath[len(path)+1:] # Package directory.
- if self.prefix and not self.prefix.endswith(os.sep):
- self.prefix += os.sep
if not path in _zip_directory_cache:
with contextlib.closing(zipfile.ZipFile(path)) as zip_file:
zip_info_list = zip_file.infolist()
More information about the Python-checkins
mailing list