aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/installer.py
diff options
context:
space:
mode:
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