Commit bbaeb0ca authored by PJ Eby's avatar PJ Eby

Fix ZipImportError when overwriting a zipfile with the same name/version

but different contents.

--HG--
branch : setuptools
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/trunk/setuptools%4043297
parent 874bb1e0
......@@ -674,7 +674,7 @@ Please make the appropriate changes for your system and try again.
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 @@ def auto_chmod(func, arg, exc):
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())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment