Skip to content

Commit

Permalink
Merge pull request #16809 from mvdbeek/versionless_tool_id_in_tool_panel
Browse files Browse the repository at this point in the history
[23.1] Fix tool panel views for versionless tool ids
  • Loading branch information
martenson authored Oct 9, 2023
2 parents d2e1b56 + 4490331 commit 7b978a0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/galaxy/tool_util/toolbox/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,12 @@ def __init__(self, toolbox: "AbstractToolBox"):

def has_tool(self, tool_id: str) -> bool:
toolbox = self.__toolbox
return tool_id in toolbox._tools_by_id or tool_id in toolbox._tools_by_old_id
# tool_id could be full guid, old tool id (no toolshed and version info) or versionless guid.
return (
tool_id in toolbox._tools_by_id
or tool_id in toolbox._tools_by_old_id
or bool(toolbox._lineage_map.lineage_map.get(tool_id))
)

def get_tool(self, tool_id: str):
return self.__toolbox.get_tool(tool_id)
Expand Down
10 changes: 9 additions & 1 deletion lib/galaxy/tool_util/toolbox/lineages/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,15 @@ def get(self, tool_id) -> Optional[ToolLineage]:
if lineage:
return lineage
if tool_id not in self.lineage_map:
tool = self.app.toolbox._tools_by_id.get(tool_id)
toolbox = None
try:
toolbox = self.app.toolbox
except AttributeError:
# We're building the lineage map while building the toolbox,
# so app.toolbox may not be available.
# TODO: is the fallback really needed / can it be fixed by improving _get_versionless ?
pass
tool = toolbox and toolbox._tools_by_id.get(tool_id)
if tool:
lineage = ToolLineage.from_tool(tool)
if lineage:
Expand Down

0 comments on commit 7b978a0

Please sign in to comment.