示例#1
0
文件: package.py 项目: jprotze/spack
    def do_install(self):
        """This class should call this version of the install method.
           Package implementations should override install().
        """
        if not self.spec.concrete:
            raise ValueError("Can only install concrete packages.")

        if os.path.exists(self.prefix):
            tty.msg("%s is already installed." % self.name)
            tty.pkg(self.prefix)
            return

        if not self.ignore_dependencies:
            self.do_install_dependencies()

        self.do_stage()
        self.setup_install_environment()

        # Add convenience commands to the package's module scope to
        # make building easier.
        self.add_commands_to_module()

        tty.msg("Building %s." % self.name)
        try:
            # create the install directory (allow the layout to handle this in
            # case it needs to add extra files)
            spack.install_layout.make_path_for_spec(self.spec)

            self.install(self.spec, self.prefix)
            if not os.path.isdir(self.prefix):
                tty.die("Install failed for %s.  No install dir created." % self.name)

        except Exception, e:
            if not self.dirty:
                self.remove_prefix()
            raise
示例#2
0
文件: package.py 项目: jprotze/spack
        try:
            # create the install directory (allow the layout to handle this in
            # case it needs to add extra files)
            spack.install_layout.make_path_for_spec(self.spec)

            self.install(self.spec, self.prefix)
            if not os.path.isdir(self.prefix):
                tty.die("Install failed for %s.  No install dir created." % self.name)

        except Exception, e:
            if not self.dirty:
                self.remove_prefix()
            raise

        tty.msg("Successfully installed %s" % self.name)
        tty.pkg(self.prefix)

        # Once the install is done, destroy the stage where we built it,
        # unless the user wants it kept around.
        if not self.dirty:
            self.stage.destroy()


    def setup_install_environment(self):
        """This ensures a clean install environment when we build packages."""
        pop_keys(os.environ, "LD_LIBRARY_PATH", "LD_RUN_PATH", "DYLD_LIBRARY_PATH")

        # Add spack environment at front of path and pass the
        # lib location along so the compiler script can find spack
        os.environ[SPACK_LIB] = lib_path