[Python-checkins] r43297 - sandbox/trunk/setuptools/setuptools/command/easy_install.py

phillip.eby python-checkins at python.org
Fri Mar 24 18:49:02 CET 2006


Author: phillip.eby
Date: Fri Mar 24 18:49:02 2006
New Revision: 43297
Modified:
 sandbox/trunk/setuptools/setuptools/command/easy_install.py
Log:
Fix ZipImportError when overwriting a zipfile with the same name/version 
but different contents.
Modified: sandbox/trunk/setuptools/setuptools/command/easy_install.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/command/easy_install.py	(original)
+++ sandbox/trunk/setuptools/setuptools/command/easy_install.py	Fri Mar 24 18:49:02 2006
@@ -674,7 +674,7 @@
 dir_util.remove_tree(destination, dry_run=self.dry_run)
 elif os.path.exists(destination):
 self.execute(os.unlink,(destination,),"Removing "+destination)
-
+ uncache_zipdir(destination)
 if os.path.isdir(egg_path):
 if egg_path.startswith(tmpdir):
 f,m = shutil.move, "Moving"
@@ -1420,19 +1420,19 @@
 raise exc[0], (exc[1][0], exc[1][1] + (" %s %s" % (func,arg)))
 
 
+def uncache_zipdir(path):
+ """Ensure that the zip directory cache doesn't have stale info for path"""
+ from zipimport import _zip_directory_cache as zdc
+ if path in zdc:
+ del zdc[path]
+ else:
+ path = normalize_path(path)
+ for p in zdc:
+ if normalize_path(p)==path:
+ del zdc[p]
+ return
 
-
-
-
-
-
-
-
-
-
-
-
-
+ 
 def get_script_args(dist, executable=sys_executable):
 """Yield write_script() argument tuples for a distribution's entrypoints"""
 spec = str(dist.as_requirement())


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /