def get_or_create_repository(ctx, owner, repo, dry_run=True, **kwds): """Clones or creates a repository and returns path on disk""" target = os.path.realpath(tempfile.mkdtemp()) remote_repo = "https://github.com/{owner}/{repo}".format(owner=owner, repo=repo) try: ctx.log('Cloning {}'.format(remote_repo)) git.clone(ctx, src=remote_repo, dest=target) except Exception: ctx.log('Creating repository {}'.format(remote_repo)) target = create_repository(ctx, owner=owner, repo=repo, dest=target, dry_run=dry_run) return target
def _path_on_disk(ctx, path): git_path = None if path.startswith("git:"): git_path = path elif path.startswith("git+"): git_path = path[len("git+"):] if git_path is None: yield path else: with temp_directory() as git_repo: git.clone(ctx, git_path, git_repo) yield git_repo
def _path_on_disk(path): git_path = None if path.startswith("git:"): git_path = path elif path.startswith("git+"): git_path = path[len("git+"):] if git_path is None: yield path else: with temp_directory() as git_repo: # TODO: pass ctx down through git.clone(None, git_path, git_repo) yield git_repo
def clone_bioconda_repo(path): """Clone bioconda repository in given path.""" bioconda_repo = "[email protected]:bioconda/bioconda-recipes.git" git.clone(None, bioconda_repo, path) return "git clone of bioconda repo worked"