diff --git a/lib/tool_shed/util/metadata_util.py b/lib/tool_shed/util/metadata_util.py index f452f941e01..308247c3ae3 100644 --- a/lib/tool_shed/util/metadata_util.py +++ b/lib/tool_shed/util/metadata_util.py @@ -1,10 +1,12 @@ import logging +from operator import itemgetter +from sqlalchemy import and_ + +import tool_shed.util.repository_util +from galaxy import util from tool_shed.util import common_util from tool_shed.util import hg_util -from sqlalchemy import and_ -from operator import itemgetter -import tool_shed.util.repository_util log = logging.getLogger( __name__ ) @@ -320,6 +322,23 @@ def get_updated_changeset_revisions( app, name, owner, changeset_revision ): return '' +def get_updated_changeset_revisions_from_tool_shed( app, tool_shed_url, name, owner, changeset_revision ): + """ + Get all appropriate newer changeset revisions for the repository defined by + the received tool_shed_url / name / owner combination. + """ + tool_shed_url = common_util.get_tool_shed_url_from_tool_shed_registry( app, tool_shed_url ) + if tool_shed_url is None or name is None or owner is None or changeset_revision is None: + message = "Unable to get updated changeset revisions from the Tool Shed because one or more of the following " + message += "required parameters is None: tool_shed_url: %s, name: %s, owner: %s, changeset_revision: %s " % \ + ( str( tool_shed_url ), str( name ), str( owner ), str( changeset_revision ) ) + raise Exception( message ) + params = dict( name=name, owner=owner, changeset_revision=changeset_revision ) + pathspec = [ 'repository', 'updated_changeset_revisions' ] + text = util.url_get( tool_shed_url, password_mgr=app.tool_shed_registry.url_auth( tool_shed_url ), pathspec=pathspec, params=params ) + return text + + def is_downloadable( metadata_dict ): # NOTE: although repository README files are considered Galaxy utilities, they have no # effect on determining if a revision is installable. See the comments in the