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.
This commit is contained in:
Ben Boeckel 2017-10-26 16:12:32 -04:00 committed by scheibelp
parent 0e464f86bb
commit bd6378a6d2

View File

@ -888,10 +888,19 @@ def is_extension(self):
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):