Example #1
0
    def add_standalone(self, spec):
        if spec.package.is_extension:
            tty.error(self._croot + 'Package %s is an extension.' % spec.name)
            return False

        if spec.external:
            tty.warn(self._croot +
                     'Skipping external package: %s' % colorize_spec(spec))
            return True

        if self.check_added(spec):
            tty.warn(self._croot + 'Skipping already linked package: %s' %
                     colorize_spec(spec))
            return True

        if spec.package.extendable:
            # Check for globally activated extensions in the extendee that
            # we're looking at.
            activated = [
                p.spec for p in spack.store.db.activated_extensions_for(spec)
            ]
            if activated:
                tty.error("Globally activated extensions cannot be used in "
                          "conjunction with filesystem views. "
                          "Please deactivate the following specs: ")
                spack.cmd.display_specs(activated,
                                        flags=True,
                                        variants=True,
                                        long=False)
                return False

        tree = LinkTree(spec.prefix)

        if not self.ignore_conflicts:
            conflict = tree.find_conflict(self.root)
            if conflict is not None:
                tty.error(self._croot +
                          "Cannot link package %s, file already exists: %s" %
                          (spec.name, conflict))
                return False

        conflicts = tree.merge(self.root,
                               link=self.link,
                               ignore=ignore_metadata_dir,
                               ignore_conflicts=self.ignore_conflicts)
        self.link_meta_folder(spec)

        if self.ignore_conflicts:
            for c in conflicts:
                tty.warn(self._croot + "Could not link: %s" % c)

        if self.verbose:
            tty.info(self._croot + 'Linked package: %s' % colorize_spec(spec))
        return True
Example #2
0
    def activate(self, extension, **kwargs):
        extensions_layout = kwargs.get("extensions_layout",
                                       spack.store.extensions)
        if extensions_layout is not spack.store.extensions:
            raise ExtensionError(
                'aspell does not support non-global extensions')

        aspell = which(self.prefix.bin.aspell)
        dest_dir = aspell('dump', 'config', 'dict-dir', output=str).strip()
        tree = LinkTree(extension.prefix.lib)

        def ignore(filename):
            return (filename in spack.store.layout.hidden_file_paths or
                    kwargs.get('ignore', lambda f: False)(filename))

        conflict = tree.find_conflict(dest_dir, ignore=ignore)
        if conflict:
            raise ExtensionConflictError(conflict)

        tree.merge(dest_dir, ignore=ignore)