Example #1
0
    def read_spec(self, path):
        """Read the contents of a file and parse them as a spec"""
        with closing(open(path)) as spec_file:
            # Specs from files are assumed normal and concrete
            spec = Spec(spec_file.read().replace('\n', ''))

        if all(spack.db.exists(s.name) for s in spec.traverse()):
            copy = spec.copy()

            # TODO: It takes a lot of time to normalize every spec on read.
            # TODO: Storing graph info with spec files would fix this.
            copy.normalize()
            if copy.concrete:
                return copy   # These are specs spack still understands.

        # If we get here, either the spec is no longer in spack, or
        # something about its dependencies has changed. So we need to
        # just assume the read spec is correct.  We'll lose graph
        # information if we do this, but this is just for best effort
        # for commands like uninstall and find.  Currently Spack
        # doesn't do anything that needs the graph info after install.

        # TODO: store specs with full connectivity information, so
        # that we don't have to normalize or reconstruct based on
        # changing dependencies in the Spack tree.
        spec._normal = True
        spec._concrete = True
        return spec
Example #2
0
    def read_spec(self, path):
        """Read the contents of a file and parse them as a spec"""
        with closing(open(path)) as spec_file:
            # Specs from files are assumed normal and concrete
            spec = Spec(spec_file.read().replace('\n', ''))

        if all(spack.db.exists(s.name) for s in spec.traverse()):
            copy = spec.copy()

            # TODO: It takes a lot of time to normalize every spec on read.
            # TODO: Storing graph info with spec files would fix this.
            copy.normalize()
            if copy.concrete:
                return copy  # These are specs spack still understands.

        # If we get here, either the spec is no longer in spack, or
        # something about its dependencies has changed. So we need to
        # just assume the read spec is correct.  We'll lose graph
        # information if we do this, but this is just for best effort
        # for commands like uninstall and find.  Currently Spack
        # doesn't do anything that needs the graph info after install.

        # TODO: store specs with full connectivity information, so
        # that we don't have to normalize or reconstruct based on
        # changing dependencies in the Spack tree.
        spec._normal = True
        spec._concrete = True
        return spec
Example #3
0
    def read_spec(self, path):
        """Read the contents of a file and parse them as a spec"""
        with closing(open(path)) as spec_file:
            # Specs from files are assumed normal and concrete
            spec = Spec(spec_file.read().replace('\n', ''))

        # If we do not have a package on hand for this spec, we know
        # it is concrete, and we *assume* that it is normal. This
        # prevents us from trying to fetch a non-existing package, and
        # allows best effort for commands like spack find.
        if not spack.db.exists(spec.name):
            spec._normal = True
            spec._concrete = True
        else:
            spec.normalize()
            if not spec.concrete:
                tty.warn("Spec read from installed package is not concrete:",
                         path, spec)

        return spec
Example #4
0
    def read_spec(self, path):
        """Read the contents of a file and parse them as a spec"""
        with closing(open(path)) as spec_file:
            # Specs from files are assumed normal and concrete
            spec = Spec(spec_file.read().replace('\n', ''))

        # If we do not have a package on hand for this spec, we know
        # it is concrete, and we *assume* that it is normal. This
        # prevents us from trying to fetch a non-existing package, and
        # allows best effort for commands like spack find.
        if not spack.db.exists(spec.name):
            spec._normal = True
            spec._concrete = True
        else:
            spec.normalize()
            if not spec.concrete:
                tty.warn("Spec read from installed package is not concrete:",
                         path, spec)

        return spec