Fix #244: errors on uninstall
- Extension logic didn't take conditional deps into account. - Extension methods now check for whether the extnesion is in the extendee map AND whether the dependency is actually present in the spec yet.
This commit is contained in:
parent
b7e926eef6
commit
52e3364efa
@ -27,9 +27,7 @@
|
|||||||
|
|
||||||
|
|
||||||
def pre_uninstall(pkg):
|
def pre_uninstall(pkg):
|
||||||
# Need to do this b/c uninstall does not automatically do it.
|
assert(pkg.spec.concrete)
|
||||||
# TODO: store full graph info in stored .spec file.
|
|
||||||
pkg.spec.normalize()
|
|
||||||
|
|
||||||
if pkg.is_extension:
|
if pkg.is_extension:
|
||||||
if pkg.activated:
|
if pkg.activated:
|
||||||
|
@ -487,7 +487,13 @@ def extendee_spec(self):
|
|||||||
if name == dep.name:
|
if name == dep.name:
|
||||||
return dep
|
return dep
|
||||||
|
|
||||||
# Otherwise return the spec from the extends() directive
|
# if the spec is concrete already, then it extends something
|
||||||
|
# that is an *optional* dependency, and the dep isn't there.
|
||||||
|
if self.spec._concrete:
|
||||||
|
return None
|
||||||
|
else:
|
||||||
|
# If it's not concrete, then return the spec from the
|
||||||
|
# extends() directive since that is all we know so far.
|
||||||
spec, kwargs = self.extendees[name]
|
spec, kwargs = self.extendees[name]
|
||||||
return spec
|
return spec
|
||||||
|
|
||||||
@ -497,18 +503,28 @@ def extendee_args(self):
|
|||||||
"""Spec of the extendee of this package, or None if it is not an extension."""
|
"""Spec of the extendee of this package, or None if it is not an extension."""
|
||||||
if not self.extendees:
|
if not self.extendees:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
# TODO: allow multiple extendees.
|
||||||
name = next(iter(self.extendees))
|
name = next(iter(self.extendees))
|
||||||
return self.extendees[name][1]
|
return self.extendees[name][1]
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_extension(self):
|
def is_extension(self):
|
||||||
return len(self.extendees) > 0
|
# if it is concrete, it's only an extension if it actually
|
||||||
|
# dependes on the extendee.
|
||||||
|
if self.spec._concrete:
|
||||||
|
return self.extendee_spec is not None
|
||||||
|
else:
|
||||||
|
# If not, then it's an extension if it *could* be an extension
|
||||||
|
return bool(self.extendees)
|
||||||
|
|
||||||
|
|
||||||
def extends(self, spec):
|
def extends(self, spec):
|
||||||
return (spec.name in self.extendees and
|
if not spec.name in self.extendees:
|
||||||
spec.satisfies(self.extendees[spec.name][0]))
|
return False
|
||||||
|
s = self.extendee_spec
|
||||||
|
return s and s.satisfies(spec)
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
Loading…
Reference in New Issue
Block a user