Exemple #1
0
    def expanded_archive_path(self):
        """Returns the path to the expanded archive directory if it's expanded;
           None if the archive hasn't been expanded.
        """
        if not self.archive_file:
            return None

        for file in os.listdir(self.path):
            archive_path = spack.new_path(self.path, file)
            if os.path.isdir(archive_path):
                return archive_path
        return None
Exemple #2
0
def bootstrap(parser, args):
    origin_url = get_origin_url()
    prefix = args.prefix

    tty.msg("Fetching spack from origin: %s" % origin_url)

    if os.path.exists(new_path(prefix, ".git")):
        tty.die("There already seems to be a git repository in %s" % prefix)

    files_in_the_way = os.listdir(prefix)
    if files_in_the_way:
        tty.die("There are already files there!  Delete these files before boostrapping spack.", *files_in_the_way)

    tty.msg("Installing:", "%s/bin/spack" % prefix, "%s/lib/spack/..." % prefix)

    os.chdir(prefix)
    check_call(["git", "init", "--shared", "-q"])
    check_call(["git", "remote", "add", "origin", origin_url])
    check_call(["git", "fetch", "origin", "master:refs/remotes/origin/master", "-n", "-q"])
    check_call(["git", "reset", "--hard", "origin/master", "-q"])

    tty.msg("Successfully created a new spack in %s" % prefix, "Run %s/bin/spack to use this installation." % prefix)
Exemple #3
0
def get_origin_url():
    git_dir = new_path(spack.prefix, ".git")
    origin_url = check_output(["git", "--git-dir=%s" % git_dir, "config", "--get", "remote.origin.url"])
    return origin_url.strip()
Exemple #4
0
def purge():
    """Remove all build directories in the top-level stage path."""
    if os.path.isdir(spack.stage_path):
        for stage_dir in os.listdir(spack.stage_path):
            stage_path = spack.new_path(spack.stage_path, stage_dir)
            remove_linked_tree(stage_path)