From a5645e353f53d4dc3b112ed245f613e54f863a31 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 2 Jul 2024 13:51:54 -0400 Subject: [PATCH] Fixes. --- lib/galaxy/tools/stock.py | 7 ++++--- lib/tool_shed/managers/tools.py | 8 ++++++-- .../tools/parameters/gx_select_multiple_optional.xml | 6 +++--- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/lib/galaxy/tools/stock.py b/lib/galaxy/tools/stock.py index b10d76db9f44..1a86354f1370 100644 --- a/lib/galaxy/tools/stock.py +++ b/lib/galaxy/tools/stock.py @@ -1,18 +1,20 @@ """Reason about stock tools based on ToolSource abstractions.""" +from pathlib import Path + from lxml.etree import XMLSyntaxError # Set GALAXY_INCLUDES_ROOT from tool shed to point this at a Galaxy root # (once we are running the tool shed from packages not rooted with Galaxy). import galaxy.tools from galaxy.tool_util.parser import get_tool_source -from galaxy.util import galaxy_root_path +from galaxy.util import galaxy_directory from galaxy.util.resources import files def stock_tool_paths(): yield from _walk_directory_for_tools(files(galaxy.tools)) - yield from _walk_directory_for_tools(galaxy_root_path / "test" / "functional" / "tools") + yield from _walk_directory_for_tools(Path(galaxy_directory()) / "test" / "functional" / "tools") def stock_tool_sources(): @@ -23,7 +25,6 @@ def stock_tool_sources(): continue - def _walk_directory_for_tools(path): if path.is_file() and path.name.endswith(".xml"): yield path diff --git a/lib/tool_shed/managers/tools.py b/lib/tool_shed/managers/tools.py index a3cd617f99d2..946609906c5c 100644 --- a/lib/tool_shed/managers/tools.py +++ b/lib/tool_shed/managers/tools.py @@ -123,7 +123,10 @@ def tool_source_for( if "~" in trs_tool_id: return _shed_tool_source_for(trans, trs_tool_id, tool_version, repository_clone_url) else: - return _stock_tool_source_for(trs_tool_id, tool_version) + tool_source = _stock_tool_source_for(trs_tool_id, tool_version) + if tool_source is None: + raise ObjectNotFound() + return tool_source def _shed_tool_source_for( @@ -151,9 +154,10 @@ def _shed_tool_source_for( def _stock_tool_source_for(tool_id: str, tool_version: str) -> Optional[ToolSource]: _init_stock_tool_sources() + assert STOCK_TOOL_SOURCES tool_version_sources = STOCK_TOOL_SOURCES.get(tool_id) if tool_version_sources is None: - return + return None return tool_version_sources.get(tool_version) diff --git a/test/functional/tools/parameters/gx_select_multiple_optional.xml b/test/functional/tools/parameters/gx_select_multiple_optional.xml index 3025b72aed54..8e42fb8b14af 100644 --- a/test/functional/tools/parameters/gx_select_multiple_optional.xml +++ b/test/functional/tools/parameters/gx_select_multiple_optional.xml @@ -1,4 +1,4 @@ - + > '$output' ]]> @@ -16,10 +16,10 @@ echo '$parameter' >> '$output' - + - +