summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Boeckel <mathstuf@users.noreply.github.com>2017-10-26 16:12:32 -0400
committerscheibelp <scheibel1@llnl.gov>2017-10-26 13:12:32 -0700
commitbd6378a6d2feb1b0d2fcd1ef4dd94fee090e86dc (patch)
tree271ceb6ec442b2d3c80fb2455e9f0aa7681e2335 /lib
parent0e464f86bbd62bb6bb6369841cb213be503aa55d (diff)
downloadspack-bd6378a6d2feb1b0d2fcd1ef4dd94fee090e86dc.tar.gz
spack-bd6378a6d2feb1b0d2fcd1ef4dd94fee090e86dc.tar.bz2
spack-bd6378a6d2feb1b0d2fcd1ef4dd94fee090e86dc.tar.xz
spack-bd6378a6d2feb1b0d2fcd1ef4dd94fee090e86dc.zip
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/package.py11
1 files changed, 10 insertions, 1 deletions
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):