Fixes for installing tool shed repositories that contain tools when done by the InstallManager, and loading the tool panel with tools in an installed repository.

This commit is contained in:
Greg Von Kuster
2012-02-29 11:34:10 -05:00
parent 63856cbc9d
commit fa550e100f
3 changed files with 17 additions and 12 deletions
+13 -7
View File
@@ -116,19 +116,25 @@ class InstallManager( object ):
changeset_revision, tmp_name ):
# Generate the metadata for the installed tool shed repository, among other things. It is critical that the installed repository is
# updated to the desired changeset_revision before metadata is set because the process for setting metadata uses the repository files on disk.
tool_panel_dict = {}
tool_panel_dict_for_display = {}
tool_panel_dict_for_metadata = {}
for tool_elem in repository_elem:
# The tool_elem looks something like this: <tool id="EMBOSS: antigenic1" version="5.0.0" file="emboss_antigenic.xml" />
tool_config = tool_elem.get( 'file' )
guid = self.get_guid( repository_clone_url, relative_install_dir, tool_config )
# See if tool_config is defined somewhere in self.proprietary_tool_panel_elems.
is_loaded, tool_section = self.get_containing_tool_section( tool_config )
tool_panel_dict_for_tool_config = generate_tool_panel_dict_for_tool_config( guid, tool_config, tool_section=tool_section )
# The tool_panel_dict_for_tool_config dictionary contains a single entry that looks something like this.
# {<Tool guid> : { tool_config : <tool_config_file>, id: <ToolSection id>, version : <ToolSection version>, name : <TooSection name>}}
# Add the new entry to the dictionary we're defining to set metadata.
for k, v in tool_panel_dict_for_tool_config.items():
tool_panel_dict_for_metadata[ k ] = v
if is_loaded:
guid = self.get_guid( repository_clone_url, relative_install_dir, tool_config )
tool_panel_dict_for_tool_config = generate_tool_panel_dict_for_tool_config( guid, tool_config, tool_section=tool_section )
# {<Tool guid> : { tool_config : <tool_config_file>, id: <ToolSection id>, version : <ToolSection version>, name : <TooSection name>}}
# Add the new entry to the dictionary we're defining to set the tool panel display.
for k, v in tool_panel_dict_for_tool_config.items():
tool_panel_dict[ k ] = v
metadata_dict = generate_metadata( self.toolbox, relative_install_dir, repository_clone_url, tool_panel_dict=tool_panel_dict )
tool_panel_dict_for_display[ k ] = v
metadata_dict = generate_metadata( self.toolbox, relative_install_dir, repository_clone_url, tool_panel_dict=tool_panel_dict_for_metadata )
# Add a new record to the tool_shed_repository table if one doesn't already exist. If one exists but is marked
# deleted, undelete it. It is critical that this happens before the call to add_to_tool_panel() below because
# tools will not be properly loaded if the repository is marked deleted.
@@ -157,7 +163,7 @@ class InstallManager( object ):
repository_tools_tups,
self.repository_owner,
self.migrated_tools_config,
tool_panel_dict,
tool_panel_dict=tool_panel_dict_for_display,
new_install=True )
# Remove the temporary file
try:
+2 -3
View File
@@ -189,14 +189,14 @@ class ToolBox( object ):
tool_panel_dict = generate_tool_panel_dict_for_repository_tools( metadata, tool_section=tool_section )
if section:
# This means all tools are loaded into the same tool panel section or are all outside of any sections.
for guid, tool_section_dict in tool_panel_dict.items():
for tool_panel_dict_guid, tool_section_dict in tool_panel_dict.items():
if tool_section_dict [ 'id' ] != section.id or \
tool_section_dict [ 'version' ] != section.version or \
tool_section_dict [ 'name' ] != section.name:
tool_section_dict [ 'id' ] = section.id
tool_section_dict [ 'version' ] = section.version
tool_section_dict [ 'name' ] = section.name
tool_panel_dict[ guid ] = tool_section_dict
tool_panel_dict[ tool_panel_dict_guid ] = tool_section_dict
update_needed = True
else:
# The tool_panel_section was introduced late, so set it's value if its missing in the metadata.
@@ -1986,7 +1986,6 @@ class Tool:
Find extra files in the job working directory and move them into
the appropriate dataset's files directory
"""
# print "Working in collect_associated_files"
for name, hda in output.items():
temp_file_path = os.path.join( job_working_directory, "dataset_%s_files" % ( hda.dataset.id ) )
try:
+2 -2
View File
@@ -18,14 +18,14 @@ def add_to_tool_panel( app, repository_name, repository_clone_url, changeset_rev
index, shed_tool_conf_dict = get_shed_tool_conf_dict( app, shed_tool_conf )
tool_path = shed_tool_conf_dict[ 'tool_path' ]
config_elems = shed_tool_conf_dict[ 'config_elems' ]
# Generate the list of ElementTree Element objects for each section or list of tools.
# Generate the list of ElementTree Element objects for each section or tool.
elem_list = generate_tool_panel_elem_list( repository_name,
repository_clone_url,
changeset_revision,
tool_panel_dict,
repository_tools_tups,
owner=owner )
# Load the tools into the tool panel outside of any sections.
# Load the tools into the tool panel.
for config_elem in elem_list:
if config_elem.tag == 'section':
app.toolbox.load_section_tag_set( config_elem, app.toolbox.tool_panel, tool_path )