Allow tool conf 'tool_path' resolution relative to conf file.

Relative 'tool_path' directories are resolved relative to GALAXY_ROOT (or really working directory). This is probably the expected behavior - but I think it is advantageous to be able to find tools relative to the tool_conf file also. This can now be done using string.Template resolution of ${tool_conf_dir}.
This commit is contained in:
John Chilton
2014-06-23 16:32:24 -05:00
parent 86648fec4b
commit 3d9da261d1
2 changed files with 14 additions and 3 deletions
+13 -2
View File
@@ -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).
+1 -1
View File
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<toolbox tool_path="test/functional/tools">
<toolbox tool_path="${tool_conf_dir}">
<tool file="upload.xml"/>
<tool file="simple_constructs.xml" />
<tool file="composite.xml" />