Always check environment markers

Fixes #2658
This commit is contained in:
Xavier Fernandez 2015-04-07 22:37:38 +02:00
parent 086e698eae
commit a947c29903
2 changed files with 14 additions and 2 deletions

View File

@ -200,8 +200,7 @@ class RequirementSet(object):
requirement is applicable and has just been added.
"""
name = install_req.name
if ((not name or not self.has_requirement(name)) and not
install_req.match_markers()):
if not install_req.match_markers():
# Only log if we haven't already got install_req from somewhere.
logger.debug("Ignore %s: markers %r don't match",
install_req.name, install_req.markers)

View File

@ -405,3 +405,16 @@ def test_filter_install():
INFO, 'foo bar')
assert _filter_install('I made a SyntaxError') == (
INFO, 'I made a SyntaxError')
def test_exclusive_environment_markers():
"""Make sure RequirementSet accepts several excluding env markers"""
eq26 = InstallRequirement.from_line(
"Django>=1.6.10,<1.7 ; python_version == '2.6'")
ne26 = InstallRequirement.from_line(
"Django>=1.6.10,<1.8 ; python_version != '2.6'")
req_set = RequirementSet('', '', '', session=PipSession())
req_set.add_requirement(eq26)
req_set.add_requirement(ne26)
assert req_set.has_requirement('Django')