diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2013-11-27 13:19:30 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2013-11-27 13:19:30 -0500 |
commit | 13f43fe5d5e468fef508c390912c715f02a51839 (patch) | |
tree | 48a5a99c6a9fe8eb3fd2022ccc0d2348e36c25c3 /ez_setup.py | |
parent | 373ed664bf8d16b0a96edaa607a82e89f64453eb (diff) | |
download | external_python_setuptools-13f43fe5d5e468fef508c390912c715f02a51839.tar.gz external_python_setuptools-13f43fe5d5e468fef508c390912c715f02a51839.tar.bz2 external_python_setuptools-13f43fe5d5e468fef508c390912c715f02a51839.zip |
Use sets to determine presence of imported modules.
Diffstat (limited to 'ez_setup.py')
-rw-r--r-- | ez_setup.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ez_setup.py b/ez_setup.py index bb451114..4d76ec27 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -115,8 +115,8 @@ def _do_download(version, download_base, to_dir, download_delay): def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, to_dir=os.curdir, download_delay=15): to_dir = os.path.abspath(to_dir) - was_imported = 'pkg_resources' in sys.modules or \ - 'setuptools' in sys.modules + rep_modules = 'pkg_resources', 'setuptools' + imported = set(sys.modules).intersection(rep_modules) try: import pkg_resources except ImportError: @@ -127,7 +127,7 @@ def use_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, except pkg_resources.DistributionNotFound: return _do_download(version, download_base, to_dir, download_delay) except pkg_resources.VersionConflict as VC_err: - if was_imported: + if imported: msg = textwrap.dedent(""" The required version of setuptools (>={version}) is not available, and can't be installed while this script is running. Please |