Commit 947b3002 authored by Jason R. Coombs's avatar Jason R. Coombs

Refactor behavior into a single try/except block with exactly one invocation of _do_download.

parent cd6f8d58
......@@ -156,12 +156,12 @@ def use_setuptools(
""")
try:
import pkg_resources
except ImportError:
return _do_download(version, download_base, to_dir, download_delay)
try:
pkg_resources.require("setuptools>=" + version)
# a suitable version is already installed
return
except ImportError:
# pkg_resources not available; setuptools is not installed; download
pass
except pkg_resources.DistributionNotFound:
# no version of setuptools was found; allow download
pass
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment