Package.provides account for v deps that are provided conditionally (#7716)

fixes #7705

Package.provides now checks constraints to ensure that a spec provides
a given virtual package. Note that 'strict=True' is not passed to
satisfies as this function is also used during concretization.
This commit is contained in:
Massimiliano Culpo 2018-04-11 21:50:03 +02:00 committed by GitHub
parent 3b44a2ff40
commit 1307ad3979
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -949,7 +949,10 @@ def provides(self, vpkg_name):
"""
True if this package provides a virtual package with the specified name
"""
return any(s.name == vpkg_name for s in self.provided)
return any(
any(self.spec.satisfies(c) for c in constraints)
for s, constraints in self.provided.items() if s.name == vpkg_name
)
@property
def installed(self):

View File

@ -515,3 +515,12 @@ def test_regression_issue_7239(self):
# Mimics asking the build interface from a build interface
build_interface = s['mpileaks']['mpileaks']
assert llnl.util.lang.ObjectWrapper in type(build_interface).__mro__
@pytest.mark.regression('7705')
def test_regression_issue_7705(self):
# spec.package.provides(name) doesn't account for conditional
# constraints in the concretized spec
s = Spec('simple-inheritance~openblas')
s.concretize()
assert not s.package.provides('lapack')