def get(galaxy_context, repository_spec): """determine how to download a repo, builds a fetch instance, and returns the instance""" fetcher = None # FIXME: note that ignore_certs for the galaxy # server(galaxy_context.server['ignore_certs']) # does not really imply that the repo archive download should ignore certs as well # (galaxy api server vs cdn) but for now, we use the value for both if repository_spec.fetch_method == FetchMethods.EDITABLE: fetcher = editable.EditableFetch(repository_spec=repository_spec, galaxy_context=galaxy_context) elif repository_spec.fetch_method == FetchMethods.SCM_URL: fetcher = scm_url.ScmUrlFetch(repository_spec=repository_spec) elif repository_spec.fetch_method == FetchMethods.LOCAL_FILE: # the file is a tar, so open it that way and extract it # to the specified (or default) content directory fetcher = local_file.LocalFileFetch(repository_spec) elif repository_spec.fetch_method == FetchMethods.REMOTE_URL: fetcher = remote_url.RemoteUrlFetch( repository_spec=repository_spec, validate_certs=not galaxy_context.server['ignore_certs']) elif repository_spec.fetch_method == FetchMethods.GALAXY_URL: fetcher = galaxy_url.GalaxyUrlFetch(repository_spec=repository_spec, galaxy_context=galaxy_context) else: raise exceptions.GalaxyError( 'No approriate content fetcher found for %s %s', repository_spec.scm, repository_spec.src) log.debug('Using fetcher: %s for repository_spec: %r', fetcher, repository_spec) return fetcher
def galaxy_url_fetch(galaxy_context): repo_spec = RepositorySpec(namespace='some_namespace', name='some_name', version='9.3.245') galaxy_url_fetch = galaxy_url.GalaxyUrlFetch(repo_spec, galaxy_context) log.debug('galaxy_url_fetch: %s', galaxy_url_fetch) return galaxy_url_fetch
def galaxy_url_fetch(galaxy_context_example_invalid): req_spec = RequirementSpec(namespace='some_namespace', name='some_name', version_spec='==9.3.245') galaxy_url_fetch = galaxy_url.GalaxyUrlFetch(requirement_spec=req_spec, galaxy_context=galaxy_context_example_invalid) log.debug('galaxy_url_fetch: %s', galaxy_url_fetch) return galaxy_url_fetch