diff options
author | Dweep Shah <dweepcan1@msn.com> | 2015-10-26 16:45:04 -0400 |
---|---|---|
committer | Dweep Shah <dweepcan1@msn.com> | 2015-10-26 16:45:04 -0400 |
commit | 7c73a66e24b9452d90b1bb7c5c29bd23911efe12 (patch) | |
tree | cb4ebc659f4ad7911c09b9677d23c2c897b9fcfe /ez_setup.py | |
parent | 825600475a66a127e1b59b39e6521c340029c660 (diff) | |
download | python-setuptools-bitbucket-7c73a66e24b9452d90b1bb7c5c29bd23911efe12.tar.gz |
Unload all pkg_resources modules and not just the main module. Fixes #453.
Diffstat (limited to 'ez_setup.py')
-rw-r--r-- | ez_setup.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ez_setup.py b/ez_setup.py index 50e0dfc6..bbfe0544 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -125,7 +125,12 @@ def _do_download(version, download_base, to_dir, download_delay): # Remove previously-imported pkg_resources if present (see # https://bitbucket.org/pypa/setuptools/pull-request/7/ for details). if 'pkg_resources' in sys.modules: - del sys.modules['pkg_resources'] + del_modules = [ + name for name in sys.modules + if name.startswith('pkg_resources') + ] + for mod_name in del_modules: + del sys.modules[mod_name] import setuptools setuptools.bootstrap_install_from = egg |