diff options
Diffstat (limited to 'pkg_resources')
| -rw-r--r-- | pkg_resources/__init__.py | 4 | ||||
| -rw-r--r-- | pkg_resources/tests/test_resources.py | 7 |
2 files changed, 10 insertions, 1 deletions
diff --git a/pkg_resources/__init__.py b/pkg_resources/__init__.py index 0534f54f..bb69b607 100644 --- a/pkg_resources/__init__.py +++ b/pkg_resources/__init__.py @@ -809,6 +809,10 @@ class WorkingSet(object): if req in processed: # Ignore cyclic or redundant dependencies continue + # If the req has a marker, evaluate it -- skipping the req if + # it evaluates to False. + if req.marker and not req.marker.evaluate(): + continue dist = best.get(req.key) if dist is None: # Find the best distribution and add it to the map diff --git a/pkg_resources/tests/test_resources.py b/pkg_resources/tests/test_resources.py index 1444b9ba..1e176771 100644 --- a/pkg_resources/tests/test_resources.py +++ b/pkg_resources/tests/test_resources.py @@ -182,6 +182,11 @@ class TestDistro: msg = 'Foo 0.9 is installed but Foo==1.2 is required' assert vc.value.report() == msg + ws = WorkingSet([]) # reset + # Environment markers are evaluated at resolution time + res = ws.resolve(parse_requirements("Foo;python_version<'2'"), ad) + assert list(res) == [] + def testDistroDependsOptions(self): d = self.distRequires(""" Twisted>=1.5 @@ -717,7 +722,7 @@ class TestNamespaces: sys.path is imported, and that the namespace package's __path__ is in the correct order. - Regression test for https://bitbucket.org/pypa/setuptools/issues/207 + Regression test for https://github.com/pypa/setuptools/issues/207 """ tmpdir = symlinked_tmpdir |
