aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/installer.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2019-12-01 09:44:24 -0500
committerJason R. Coombs <jaraco@jaraco.com>2019-12-01 09:44:24 -0500
commitf8a6f27b42078292fa8624d294558ffcf884c7cd (patch)
treee92ed09959918ccb4803f3b7d58bb12b43f9c04f /setuptools/installer.py
parent6f46a4b703d4db225e96bb871e1bf6a7c3597329 (diff)
parent812b83c9b4c6134c559f8609b69bca37d7c1204d (diff)
downloadexternal_python_setuptools-f8a6f27b42078292fa8624d294558ffcf884c7cd.tar.gz
external_python_setuptools-f8a6f27b42078292fa8624d294558ffcf884c7cd.tar.bz2
external_python_setuptools-f8a6f27b42078292fa8624d294558ffcf884c7cd.zip
Merge branch 'master' into fix_handling_of_find-links_in_setup.cfg
Diffstat (limited to 'setuptools/installer.py')
-rw-r--r--setuptools/installer.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/setuptools/installer.py b/setuptools/installer.py
index a5816608..9f8be2ef 100644
--- a/setuptools/installer.py
+++ b/setuptools/installer.py
@@ -73,8 +73,8 @@ def fetch_build_egg(dist, req):
pkg_resources.get_distribution('wheel')
except pkg_resources.DistributionNotFound:
dist.announce('WARNING: The wheel package is not available.', log.WARN)
- if not isinstance(req, pkg_resources.Requirement):
- req = pkg_resources.Requirement.parse(req)
+ # Ignore environment markers; if supplied, it is required.
+ req = strip_marker(req)
# Take easy_install options into account, but do not override relevant
# pip environment variables (like PIP_INDEX_URL or PIP_QUIET); they'll
# take precedence.
@@ -136,3 +136,15 @@ def fetch_build_egg(dist, req):
dist = pkg_resources.Distribution.from_filename(
dist_location, metadata=dist_metadata)
return dist
+
+
+def strip_marker(req):
+ """
+ Return a new requirement without the environment marker to avoid
+ calling pip with something like `babel; extra == "i18n"`, which
+ would always be ignored.
+ """
+ # create a copy to avoid mutating the input
+ req = pkg_resources.Requirement.parse(str(req))
+ req.marker = None
+ return req