From 3476c7f92848ff650bc9d148ad95712adf45c8ae Mon Sep 17 00:00:00 2001 From: Marius van den Beek Date: Fri, 11 Mar 2016 16:39:01 +0100 Subject: [PATCH] Split the path on 'repos', so that toolsheds that are on a subdirectory do not show errors when loading tools if there is actually no error. --- lib/galaxy/tools/toolbox/base.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/lib/galaxy/tools/toolbox/base.py b/lib/galaxy/tools/toolbox/base.py index 51a7c8000c4f..974fbff13f62 100644 --- a/lib/galaxy/tools/toolbox/base.py +++ b/lib/galaxy/tools/toolbox/base.py @@ -558,20 +558,22 @@ def _load_tool_tag_set( self, item, panel_dict, integrated_panel_dict, tool_path # Backward compatibility issue - the tag used to be named 'changeset_revision'. installed_changeset_revision_elem = item.elem.find( "changeset_revision" ) installed_changeset_revision = installed_changeset_revision_elem.text - try: - splitted_path = path.split('/') - assert splitted_path[0] == tool_shed - assert splitted_path[2] == repository_owner - assert splitted_path[3] == repository_name - if splitted_path[4] != installed_changeset_revision: - # This can happen if the Tool Shed repository has been - # updated to a new revision and the installed_changeset_revision - # element in shed_tool_conf.xml file has been updated too - log.debug("The installed_changeset_revision for tool %s is %s, using %s instead", path, installed_changeset_revision, splitted_path[4]) - installed_changeset_revision = splitted_path[4] - except Exception as e: - log.debug("Error while loading tool %s : %s", path, e) - pass + if "/repos/" in path: # The only time "/repos/" should not be in path is during testing! + try: + tool_shed_path, reduced_path = path.split('/repos/', 1) + splitted_path = reduced_path.split('/') + assert tool_shed_path == tool_shed + assert splitted_path[0] == repository_owner + assert splitted_path[1] == repository_name + if splitted_path[2] != installed_changeset_revision: + # This can happen if the Tool Shed repository has been + # updated to a new revision and the installed_changeset_revision + # element in shed_tool_conf.xml file has been updated too + log.debug("The installed_changeset_revision for tool %s is %s, using %s instead", path, installed_changeset_revision, splitted_path[2]) + installed_changeset_revision = splitted_path[2] + except AssertionError: + log.debug("Error while loading tool %s", path) + pass tool_shed_repository = self._get_tool_shed_repository( tool_shed, repository_name, repository_owner,