'Called on the extension to invoke extendee\'s deactivate() method.'

def do_deactivate(self, **kwargs):

    self._sanity_check_extension()
    force = kwargs.get('force', False)
    if (not force):
        spack.store.layout.check_activated(self.extendee_spec, self.spec)
        activated = spack.store.layout.extension_map(self.extendee_spec)
        for (name, aspec) in activated.items():
            if (aspec == self.spec):
                continue
            for dep in aspec.traverse(deptype='run'):
                if (self.spec == dep):
                    msg = 'Cannot    deactivate    %s    because    %s    is    activated    and    depends    on    it.'
                    raise ActivationError((msg % (self.spec.short_spec, aspec.short_spec)))
    self.extendee_spec.package.deactivate(self, **self.extendee_args)
    if self.activated:
        spack.store.layout.remove_extension(self.extendee_spec, self.spec)
    tty.msg(('Deactivated    extension    %s    for    %s' % (self.spec.short_spec, self.extendee_spec.cformat('$_$@$+$%@'))))
