From cf6639df27879641b6ea561fa38ec52320b09780 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Mon, 16 Feb 2015 09:42:21 -0500 Subject: Add comments --- ez_setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ez_setup.py') 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) -- cgit v1.2.3