diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2015-02-16 09:42:21 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2015-02-16 09:42:21 -0500 |
commit | cf6639df27879641b6ea561fa38ec52320b09780 (patch) | |
tree | 477365afa887de971d8c3d853dae507f63e299cf | |
parent | 5d2f77f308c8ccc89be855994da1b7503b5a4294 (diff) | |
download | external_python_setuptools-cf6639df27879641b6ea561fa38ec52320b09780.tar.gz external_python_setuptools-cf6639df27879641b6ea561fa38ec52320b09780.tar.bz2 external_python_setuptools-cf6639df27879641b6ea561fa38ec52320b09780.zip |
Add comments
-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 1a360ced..154cae0a 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -160,16 +160,21 @@ def use_setuptools( return _do_download(version, download_base, to_dir, download_delay) try: pkg_resources.require("setuptools>=" + version) + # a suitable version is already installed return except pkg_resources.DistributionNotFound: + # no version of setuptools was found return _do_download(version, download_base, to_dir, download_delay) except pkg_resources.VersionConflict as VC_err: if imported: + # setuptools was imported prior to invocation of this function, + # so it's not safe to unload it. msg = conflict_tmpl.format(VC_err=VC_err, version=version) sys.stderr.write(msg) sys.exit(2) - # otherwise, reload ok + # otherwise, unload pkg_resources to allow the downloaded version to + # take precedence. del pkg_resources, sys.modules['pkg_resources'] return _do_download(version, download_base, to_dir, download_delay) |