From bd6378a6d2feb1b0d2fcd1ef4dd94fee090e86dc Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 26 Oct 2017 16:12:32 -0400 Subject: Package.extends: update semantics when package isn't concrete (#5600) This updates the logic for Package.extends so that if the spec associated with the package is not concrete, it will report true if the package *could extend* the given spec; generally speaking a package could extend a spec as long as none of the details associated with its extendee spec conflict with the given spec. When the spec associated with the package is concrete, this function will only report whether the package *does extend* the given spec. When both the specs are concrete, the semantics are the same as before. --- lib/spack/spack/package.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index be0f03fe01..caf47afc95 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -888,10 +888,19 @@ class PackageBase(with_metaclass(PackageMeta, object)): return bool(self.extendees) def extends(self, spec): + ''' + Returns True if this package extends the given spec. + + If ``self.spec`` is concrete, this returns whether this package extends + the given spec. + + If ``self.spec`` is not concrete, this returns whether this package may + extend the given spec. + ''' if spec.name not in self.extendees: return False s = self.extendee_spec - return s and s.satisfies(spec) + return s and spec.satisfies(s) @property def activated(self): -- cgit v1.2.3-60-g2f50