How to use the installer.bootstrap.Toolbox function in installer

To help you get started, we’ve selected a few installer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dials / dials / installer / bootstrap.py View on Github external
def _indirection():
            Toolbox().git(
                module,
                parameters,
                destination=destination,
                use_ssh=use_git_ssh,
                verbose=True,
                reference=reference_repository_path,
            )
github dials / dials / installer / bootstrap.py View on Github external
returncode = ShellCommand(command=cmd, workdir=destpath).run()
                if returncode:
                    return returncode  # no point trying to continue on error
                if reference_parameters:
                    # Sever the link between checked out and reference repository
                    cmd = ["git", "repack", "-a", "-d"]
                    returncode = ShellCommand(command=cmd, workdir=destination).run()
                    try:
                        os.remove(
                            os.path.join(
                                destination, ".git", "objects", "info", "alternates"
                            )
                        )
                    except OSError:
                        returncode = 1
                Toolbox.set_git_repository_config_to_rebase(
                    os.path.join(destination, ".git", "config")
                )
                if returncode:
                    return returncode  # no point trying to continue on error
                # Show the hash for the checked out commit for debugging purposes, ignore any failures.
                ShellCommand(
                    command=["git", "rev-parse", "HEAD"], workdir=destination
                ).run()
                return returncode
            filename = "%s-%s" % (module, urlparse(source_candidate)[2].split("/")[-1])
            filename = os.path.join(destpath, filename)
            if verbose:
                print("===== Downloading %s: " % source_candidate, end=" ")
            Toolbox.download_to_file(source_candidate, filename)
            Toolbox.unzip(filename, destination, trim_directory=1, verbose=verbose)
            return
github dials / dials / installer / bootstrap.py View on Github external
Toolbox.set_git_repository_config_to_rebase(
                    os.path.join(destination, ".git", "config")
                )
                if returncode:
                    return returncode  # no point trying to continue on error
                # Show the hash for the checked out commit for debugging purposes, ignore any failures.
                ShellCommand(
                    command=["git", "rev-parse", "HEAD"], workdir=destination
                ).run()
                return returncode
            filename = "%s-%s" % (module, urlparse(source_candidate)[2].split("/")[-1])
            filename = os.path.join(destpath, filename)
            if verbose:
                print("===== Downloading %s: " % source_candidate, end=" ")
            Toolbox.download_to_file(source_candidate, filename)
            Toolbox.unzip(filename, destination, trim_directory=1, verbose=verbose)
            return

        error = (
            "Cannot satisfy git dependency for module %s: None of the sources are available."
            % module
        )
        if not git_available:
            print(error)
            error = "A git installation has not been found."
        raise Exception(error)