コード例 #1
0
 def get_repo_info_dict_for_repair(self, rdim, repository):
     tool_panel_section_key = None
     repository_clone_url = common_util.generate_clone_url_for_installed_repository(
         self.app, repository)
     repository_dependencies = rdim.get_repository_dependencies_for_installed_tool_shed_repository(
         self.app, repository)
     metadata = repository.metadata
     if metadata:
         tool_dependencies = metadata.get('tool_dependencies', None)
         tool_panel_section_dict = metadata.get('tool_panel_section', None)
         if tool_panel_section_dict:
             # The repository must be in the uninstalled state.  The structure of tool_panel_section_dict is:
             # {<tool guid> :
             # [{ 'id':<section id>, 'name':<section name>, 'version':<section version>, 'tool_config':<tool config file name> }]}
             # Here is an example:
             # {"localhost:9009/repos/test/filter/Filter1/1.1.0":
             # [{"id": "filter_and_sort", "name": "Filter and Sort", "tool_config": "filtering.xml", "version": ""}]}
             # Currently all tools contained within an installed tool shed repository must be loaded into the same
             # section in the tool panel, so we can get the section id of the first guid in the tool_panel_section_dict.
             # In the future, we'll have to handle different sections per guid.
             guid = tool_panel_section_dict.keys()[0]
             section_dicts = tool_panel_section_dict[guid]
             section_dict = section_dicts[0]
             tool_panel_section_id = section_dict['id']
             tool_panel_section_name = section_dict['name']
             if tool_panel_section_id:
                 tpm = tool_panel_manager.ToolPanelManager(self.app)
                 tool_panel_section_key, _ = \
                     tpm.get_or_create_tool_section( self.app.toolbox,
                                                     tool_panel_section_id=tool_panel_section_id,
                                                     new_tool_panel_section_label=tool_panel_section_name )
     else:
         tool_dependencies = None
     repo_info_dict = repository_util.create_repo_info_dict(
         app=self.app,
         repository_clone_url=repository_clone_url,
         changeset_revision=repository.changeset_revision,
         ctx_rev=repository.ctx_rev,
         repository_owner=repository.owner,
         repository_name=repository.name,
         repository=None,
         repository_metadata=None,
         tool_dependencies=tool_dependencies,
         repository_dependencies=repository_dependencies)
     return repo_info_dict, tool_panel_section_key
コード例 #2
0
 def get_repo_info_dict_for_repair( self, rdim, repository ):
     tool_panel_section_key = None
     repository_clone_url = common_util.generate_clone_url_for_installed_repository( self.app, repository )
     repository_dependencies = rdim.get_repository_dependencies_for_installed_tool_shed_repository( self.app,
                                                                                                    repository )
     metadata = repository.metadata
     if metadata:
         tool_dependencies = metadata.get( 'tool_dependencies', None )
         tool_panel_section_dict = metadata.get( 'tool_panel_section', None )
         if tool_panel_section_dict:
             # The repository must be in the uninstalled state.  The structure of tool_panel_section_dict is:
             # {<tool guid> :
             # [{ 'id':<section id>, 'name':<section name>, 'version':<section version>, 'tool_config':<tool config file name> }]}
             # Here is an example:
             # {"localhost:9009/repos/test/filter/Filter1/1.1.0":
             # [{"id": "filter_and_sort", "name": "Filter and Sort", "tool_config": "filtering.xml", "version": ""}]}
             # Currently all tools contained within an installed tool shed repository must be loaded into the same
             # section in the tool panel, so we can get the section id of the first guid in the tool_panel_section_dict.
             # In the future, we'll have to handle different sections per guid.
             guid = tool_panel_section_dict.keys()[ 0 ]
             section_dicts = tool_panel_section_dict[ guid ]
             section_dict = section_dicts[ 0 ]
             tool_panel_section_id = section_dict[ 'id' ]
             tool_panel_section_name = section_dict[ 'name' ]
             if tool_panel_section_id:
                 tpm = tool_panel_manager.ToolPanelManager( self.app )
                 tool_panel_section_key, _ = \
                     tpm.get_or_create_tool_section( self.app.toolbox,
                                                     tool_panel_section_id=tool_panel_section_id,
                                                     new_tool_panel_section_label=tool_panel_section_name )
     else:
         tool_dependencies = None
     repo_info_dict = repository_util.create_repo_info_dict( app=self.app,
                                                             repository_clone_url=repository_clone_url,
                                                             changeset_revision=repository.changeset_revision,
                                                             ctx_rev=repository.ctx_rev,
                                                             repository_owner=repository.owner,
                                                             repository_name=repository.name,
                                                             repository=None,
                                                             repository_metadata=None,
                                                             tool_dependencies=tool_dependencies,
                                                             repository_dependencies=repository_dependencies )
     return repo_info_dict, tool_panel_section_key