Extract function to strip the marker for concise code in the long function.
This commit is contained in:
parent
2292718a15
commit
a2e883e1b8
|
@ -64,11 +64,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)
|
||||
# Ignore environment markers: if we're here, it's needed. This ensure
|
||||
# we don't try to ask pip for something like `babel; extra == "i18n"`,
|
||||
# which would always be ignored.
|
||||
req = pkg_resources.Requirement.parse(str(req))
|
||||
req.marker = None
|
||||
# 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.
|
||||
|
@ -130,3 +127,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
|
||||
|
|
Loading…
Reference in New Issue