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:
parent
3b44a2ff40
commit
1307ad3979
@ -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):
|
||||
|
@ -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')
|
||||
|
Loading…
Reference in New Issue
Block a user