def update_in_shed_tool_config(self): """ A tool shed repository is being updated so change the shed_tool_conf file. Parse the config file to generate the entire list of config_elems instead of using the in-memory list. """ shed_conf_dict = self.shed_config_dict or self.repository.get_shed_config_dict( self.app) shed_tool_conf = shed_conf_dict['config_filename'] tool_path = shed_conf_dict['tool_path'] self.tpm.generate_tool_panel_dict_from_shed_tool_conf_entries( self.repository) repository_tools_tups = self.get_repository_tools_tups() clone_url = common_util.generate_clone_url_for_installed_repository( self.app, self.repository) tool_shed = self.tool_shed_from_repository_clone_url() owner = self.repository.owner if not owner: cleaned_repository_clone_url = common_util.remove_protocol_and_user_from_clone_url( clone_url) owner = get_repository_owner(cleaned_repository_clone_url) guid_to_tool_elem_dict = {} for tool_config_filename, guid, tool in repository_tools_tups: guid_to_tool_elem_dict[guid] = self.tpm.generate_tool_elem( tool_shed, self.repository.name, self.repository.changeset_revision, self.repository.owner or '', tool_config_filename, tool, None) config_elems = [] tree, error_message = xml_util.parse_xml(shed_tool_conf) if tree: root = tree.getroot() for elem in root: if elem.tag == 'section': for i, tool_elem in enumerate(elem): guid = tool_elem.attrib.get('guid') if guid in guid_to_tool_elem_dict: elem[i] = guid_to_tool_elem_dict[guid] elif elem.tag == 'tool': guid = elem.attrib.get('guid') if guid in guid_to_tool_elem_dict: elem = guid_to_tool_elem_dict[guid] config_elems.append(elem) self.tpm.config_elems_to_xml_file(config_elems, shed_tool_conf, tool_path)
def set_repository(self, repository): super().set_repository(repository) self.repository_clone_url = common_util.generate_clone_url_for_installed_repository( self.app, repository)
def set_repository(self, repository): super(InstalledRepositoryMetadataManager, self).set_repository(repository) self.repository_clone_url = common_util.generate_clone_url_for_installed_repository( self.app, repository)