diff --git a/lib/galaxy/tools/__init__.py b/lib/galaxy/tools/__init__.py index 131294e6a63..10a9b2b217d 100755 --- a/lib/galaxy/tools/__init__.py +++ b/lib/galaxy/tools/__init__.py @@ -11,6 +11,7 @@ import pipes import re import shutil import sys +import string import tempfile import threading import traceback @@ -214,8 +215,7 @@ class ToolBox( object, Dictifiable ): config_elems = [] else: parsing_shed_tool_conf = False - # Default to backward compatible config setting. - tool_path = self.tool_root_dir + tool_path = self.__resolve_tool_path(tool_path, config_filename) # Only load the panel_dict under certain conditions. load_panel_dict = not self.integrated_tool_panel_config_has_contents for _, elem in enumerate( root ): @@ -243,6 +243,17 @@ class ToolBox( object, Dictifiable ): return shed_config_dict return default + def __resolve_tool_path(self, tool_path, config_filename): + if not tool_path: + # Default to backward compatible config setting. + tool_path = self.tool_root_dir + else: + # Allow use of __tool_conf_dir__ in toolbox config files. + tool_conf_dir = os.path.dirname(config_filename) + tool_path_vars = {"tool_conf_dir": tool_conf_dir} + tool_path = string.Template(tool_path).safe_substitute(tool_path_vars) + return tool_path + def __add_tool_to_tool_panel( self, tool, panel_component, section=False ): # See if a version of this tool is already loaded into the tool panel. The value of panel_component # will be a ToolSection (if the value of section=True) or self.tool_panel (if section=False). diff --git a/test/functional/tools/samples_tool_conf.xml b/test/functional/tools/samples_tool_conf.xml index 52f3e54bbba..918e7c5a5e9 100644 --- a/test/functional/tools/samples_tool_conf.xml +++ b/test/functional/tools/samples_tool_conf.xml @@ -1,5 +1,5 @@ - +