diff options
author | Massimiliano Culpo <massimiliano.culpo@gmail.com> | 2018-04-11 21:50:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-11 21:50:03 +0200 |
commit | 1307ad3979498916011df47121bba1020da9f2e8 (patch) | |
tree | a46d186355686c04fc270ce0f11d910c6b6fef54 /lib | |
parent | 3b44a2ff404d33cf7533621dcd36afef430d8389 (diff) | |
download | spack-1307ad3979498916011df47121bba1020da9f2e8.tar.gz spack-1307ad3979498916011df47121bba1020da9f2e8.tar.bz2 spack-1307ad3979498916011df47121bba1020da9f2e8.tar.xz spack-1307ad3979498916011df47121bba1020da9f2e8.zip |
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.
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') |