package: rename activated
to is_activated
This allows the activation code to be later given parameters.
This commit is contained in:
parent
f31b47c353
commit
af0cf2d3c6
@ -50,7 +50,7 @@ def activate(parser, args):
|
|||||||
if not spec.package.is_extension:
|
if not spec.package.is_extension:
|
||||||
tty.die("%s is not an extension." % spec.name)
|
tty.die("%s is not an extension." % spec.name)
|
||||||
|
|
||||||
if spec.package.activated:
|
if spec.package.is_activated():
|
||||||
tty.die("Package %s is already activated." % specs[0].short_spec)
|
tty.die("Package %s is already activated." % specs[0].short_spec)
|
||||||
|
|
||||||
spec.package.do_activate()
|
spec.package.do_activate()
|
||||||
|
@ -63,11 +63,11 @@ def deactivate(parser, args):
|
|||||||
|
|
||||||
for ext_pkg in ext_pkgs:
|
for ext_pkg in ext_pkgs:
|
||||||
ext_pkg.spec.normalize()
|
ext_pkg.spec.normalize()
|
||||||
if ext_pkg.activated:
|
if ext_pkg.is_activated():
|
||||||
ext_pkg.do_deactivate(force=True)
|
ext_pkg.do_deactivate(force=True)
|
||||||
|
|
||||||
elif pkg.is_extension:
|
elif pkg.is_extension:
|
||||||
if not args.force and not spec.package.activated:
|
if not args.force and not spec.package.is_activated():
|
||||||
tty.die("%s is not activated." % pkg.spec.short_spec)
|
tty.die("%s is not activated." % pkg.spec.short_spec)
|
||||||
|
|
||||||
tty.msg("Deactivating %s and all dependencies." %
|
tty.msg("Deactivating %s and all dependencies." %
|
||||||
@ -80,7 +80,7 @@ def deactivate(parser, args):
|
|||||||
espec = index[name]
|
espec = index[name]
|
||||||
epkg = espec.package
|
epkg = espec.package
|
||||||
if epkg.extends(pkg.extendee_spec):
|
if epkg.extends(pkg.extendee_spec):
|
||||||
if epkg.activated or args.force:
|
if epkg.is_activated() or args.force:
|
||||||
|
|
||||||
epkg.do_deactivate(force=args.force)
|
epkg.do_deactivate(force=args.force)
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ def deactivate(parser, args):
|
|||||||
tty.die("spack deactivate requires an extension.",
|
tty.die("spack deactivate requires an extension.",
|
||||||
"Did you mean 'spack deactivate --all'?")
|
"Did you mean 'spack deactivate --all'?")
|
||||||
|
|
||||||
if not args.force and not spec.package.activated:
|
if not args.force and not spec.package.is_activated():
|
||||||
tty.die("Package %s is not activated." % specs[0].short_spec)
|
tty.die("Package %s is not activated." % specs[0].short_spec)
|
||||||
|
|
||||||
spec.package.do_deactivate(force=args.force)
|
spec.package.do_deactivate(force=args.force)
|
||||||
|
@ -29,5 +29,5 @@ def pre_uninstall(spec):
|
|||||||
assert spec.concrete
|
assert spec.concrete
|
||||||
|
|
||||||
if pkg.is_extension:
|
if pkg.is_extension:
|
||||||
if pkg.activated:
|
if pkg.is_activated():
|
||||||
pkg.do_deactivate(force=True)
|
pkg.do_deactivate(force=True)
|
||||||
|
@ -903,8 +903,8 @@ def extends(self, spec):
|
|||||||
s = self.extendee_spec
|
s = self.extendee_spec
|
||||||
return s and spec.satisfies(s)
|
return s and spec.satisfies(s)
|
||||||
|
|
||||||
@property
|
def is_activated(self):
|
||||||
def activated(self):
|
"""Return True if package is activated."""
|
||||||
if not self.is_extension:
|
if not self.is_extension:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"is_extension called on package that is not an extension.")
|
"is_extension called on package that is not an extension.")
|
||||||
@ -1787,7 +1787,7 @@ def do_activate(self, force=False):
|
|||||||
# Activate any package dependencies that are also extensions.
|
# Activate any package dependencies that are also extensions.
|
||||||
if not force:
|
if not force:
|
||||||
for spec in self.dependency_activations():
|
for spec in self.dependency_activations():
|
||||||
if not spec.package.activated:
|
if not spec.package.is_activated():
|
||||||
spec.package.do_activate(force=force)
|
spec.package.do_activate(force=force)
|
||||||
|
|
||||||
self.extendee_spec.package.activate(self, **self.extendee_args)
|
self.extendee_spec.package.activate(self, **self.extendee_args)
|
||||||
@ -1849,7 +1849,7 @@ def do_deactivate(self, **kwargs):
|
|||||||
|
|
||||||
# redundant activation check -- makes SURE the spec is not
|
# redundant activation check -- makes SURE the spec is not
|
||||||
# still activated even if something was wrong above.
|
# still activated even if something was wrong above.
|
||||||
if self.activated:
|
if self.is_activated():
|
||||||
spack.store.layout.remove_extension(
|
spack.store.layout.remove_extension(
|
||||||
self.extendee_spec, self.spec)
|
self.extendee_spec, self.spec)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user