diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/package.py | 5 | ||||
-rw-r--r-- | lib/spack/spack/test/concretize.py | 9 |
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index 3dc99e1cef..9117cbbaea 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -949,7 +949,10 @@ class PackageBase(with_metaclass(PackageMeta, object)): """ 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): diff --git a/lib/spack/spack/test/concretize.py b/lib/spack/spack/test/concretize.py index 0478d5233b..13dd490d24 100644 --- a/lib/spack/spack/test/concretize.py +++ b/lib/spack/spack/test/concretize.py @@ -515,3 +515,12 @@ class TestConcretize(object): # 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') |