예제 #1
0
파일: package.py 프로젝트: jprotze/spack
 def clean(self):
     """By default just runs make clean.  Override if this isn't good."""
     try:
         make = MakeExecutable('make', self.parallel)
         make('clean')
         tty.msg("Successfully cleaned %s" % self.name)
     except subprocess.CalledProcessError, e:
         tty.warn("Warning: 'make clean' didn't work.  Consider 'spack clean --work'.")
예제 #2
0
파일: package.py 프로젝트: jprotze/spack
    def do_uninstall(self):
        if not os.path.exists(self.prefix):
            tty.die(self.name + " is not installed.")

        if not self.ignore_dependencies:
            deps = self.installed_dependents
            if deps: tty.die(
                "Cannot uninstall %s. The following installed packages depend on it:"
                % self.name, " ".join(deps))

        self.remove_prefix()
        tty.msg("Successfully uninstalled %s." % self.name)
예제 #3
0
파일: package.py 프로젝트: jprotze/spack
    def do_stage(self):
        """Unpacks the fetched tarball, then changes into the expanded tarball
           directory."""
        self.do_fetch()

        archive_dir = self.stage.expanded_archive_path
        if not archive_dir:
            tty.msg("Staging archive: %s" % self.stage.archive_file)
            self.stage.expand_archive()
        else:
            tty.msg("Already staged %s" % self.name)
        self.stage.chdir_to_archive()
예제 #4
0
파일: package.py 프로젝트: jprotze/spack
    def do_fetch(self):
        """Creates a stage directory and downloads the taball for this package.
           Working directory will be set to the stage directory.
        """
        self.stage.setup()

        if spack.do_checksum and not self.version in self.versions:
            tty.die("Cannot fetch %s@%s safely; there is no checksum on file for this "
                    "version." % (self.name, self.version),
                    "Add a checksum to the package file, or use --no-checksum to "
                    "skip this check.")

        self.stage.fetch()

        if self.version in self.versions:
            digest = self.versions[self.version]
            checker = crypto.Checker(digest)
            if checker.check(self.stage.archive_file):
                tty.msg("Checksum passed for %s" % self.name)
            else:
                tty.die("%s checksum failed for %s.  Expected %s but got %s."
                        % (checker.hash_name, self.name, digest, checker.sum))
예제 #5
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
예제 #6
0
파일: package.py 프로젝트: jprotze/spack
 def do_clean_dist(self):
     """Removes the stage directory where this package was built."""
     if os.path.exists(self.stage.path):
         self.stage.destroy()
     tty.msg("Successfully cleaned %s" % self.name)
예제 #7
0
파일: package.py 프로젝트: jprotze/spack
        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

        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