diff options
| author | PJ Eby <distutils-sig@python.org> | 2006-07-10 21:30:12 +0000 |
|---|---|---|
| committer | PJ Eby <distutils-sig@python.org> | 2006-07-10 21:30:12 +0000 |
| commit | 9ba52cf30de1f9e8c019481e615fd661e4533bd2 (patch) | |
| tree | 60865a60eb6c294e17bc98f920fcce20536d6a9c | |
| parent | ece23fd51b6eb14ea4a5853ad1a7f315d76ddcf5 (diff) | |
| download | python-setuptools-git-9ba52cf30de1f9e8c019481e615fd661e4533bd2.tar.gz | |
Fix ``sys.path_importer_cache`` not being updated when an existing zipfile
or directory is deleted/overwritten.
--HG--
branch : setuptools-0.6
extra : convert_revision : svn%3A6015fed2-1504-0410-9fe1-9d1591cc4771/sandbox/branches/setuptools-0.6%4050546
| -rwxr-xr-x | EasyInstall.txt | 3 | ||||
| -rwxr-xr-x | setuptools/command/easy_install.py | 18 |
2 files changed, 12 insertions, 9 deletions
diff --git a/EasyInstall.txt b/EasyInstall.txt index 541de858..c8b726c4 100755 --- a/EasyInstall.txt +++ b/EasyInstall.txt @@ -1101,6 +1101,9 @@ Release Notes/Change History * 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``. diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index 26f59e1a..71e9d6f2 100755 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1410,7 +1410,6 @@ def get_script_header(script_text, executable=sys_executable): 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) @@ -1418,21 +1417,22 @@ def auto_chmod(func, arg, exc): exc = sys.exc_info() 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""" + """Ensure that the importer caches dont have stale info for `path`""" from zipimport import _zip_directory_cache as zdc - if path in zdc: - del zdc[path] + _uncache(path, zdc) + _uncache(path, sys.path_importer_cache) + +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: |
