Commits

Anonymous committed 930b465

Fix ``sys.path_importer_cache`` not being updated when an existing zipfile
or directory is deleted/overwritten.

  • Participants
  • Parent commits cde31fb
  • Branches setuptools-0.6

Comments (0)

Files changed (2)

File EasyInstall.txt

  * Fix ``ftp://`` directory listing URLs from causing a crash when used in the
    "Home page" or "Download URL" slots on PyPI.
 
+ * Fix ``sys.path_importer_cache`` not being updated when an existing zipfile
+   or directory is deleted/overwritten.
+
 0.6b3
  * Fix local ``--find-links`` eggs not being copied except with
    ``--always-copy``.

File setuptools/command/easy_install.py

             options = ' '+options
     return "#!%(executable)s%(options)s\n" % locals()
 
-
 def auto_chmod(func, arg, exc):
     if func is os.remove and os.name=='nt':
         os.chmod(arg, stat.S_IWRITE)
     exc = sys.exc_info()
     raise exc[0], (exc[1][0], exc[1][1] + (" %s %s" % (func,arg)))
 
+def uncache_zipdir(path):
+    """Ensure that the importer caches dont have stale info for `path`"""
+    from zipimport import _zip_directory_cache as zdc
+    _uncache(path, zdc)
+    _uncache(path, sys.path_importer_cache)
 
-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]
+def _uncache(path, cache):
+    if path in cache:
+        del cache[path]
     else:
         path = normalize_path(path)
-        for p in zdc:
+        for p in cache:
             if normalize_path(p)==path:
-                del zdc[p]
+                del cache[p]
                 return
 
-
-
 def is_python(text, filename='<string>'):
     "Is this string a valid Python script?"
     try: