Commit dd5caefb authored by Jason R. Coombs's avatar Jason R. Coombs

Always inject extra into the environment when evaluating markers. Fixes #544.

parent bc351609
......@@ -2,6 +2,12 @@
CHANGES
=======
v20.8.1
-------
* Issue #544: Fix issue with extra environment marker
processing in WorkingSet due to refactor in v20.7.0.
v20.8.0
-------
......
......@@ -988,9 +988,9 @@ class _ReqExtras(dict):
"""
extra_evals = (
req.marker.evaluate({'extra': extra})
for extra in self.get(req, ())
for extra in self.get(req, ()) + (None,)
)
return not req.marker or any(extra_evals) or req.marker.evaluate()
return not req.marker or any(extra_evals)
class Environment(object):
......
......@@ -189,7 +189,7 @@ class TestDistro:
def test_environment_marker_evaluation_called(self):
"""
If one package foo requires bar without any extras,
markers should pass for bar.
markers should pass for bar without extras.
"""
parent_req, = parse_requirements("foo")
req, = parse_requirements("bar;python_version>='2'")
......@@ -201,14 +201,6 @@ class TestDistro:
req_extras = pkg_resources._ReqExtras({req: parent_req.extras})
assert req_extras.markers_pass(req)
# extra should not be present in the marker namespace if
# no markers were supplied
parent_req, = parse_requirements("foo")
req, = parse_requirements("bar;extra==''")
req_extras = pkg_resources._ReqExtras({req: parent_req.extras})
with pytest.raises(packaging.markers.UndefinedEnvironmentName):
req_extras.markers_pass(req)
def test_marker_evaluation_with_extras(self):
"""Extras are also evaluated as markers at resolution time."""
ad = pkg_resources.Environment([])
......
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