def order_repositories_for_installation( self, tool_shed_repositories, repository_dependencies_dict ):
     """
     Some repositories may have repository dependencies that are required to be installed before the dependent
     repository.  This method will inspect the list of repositories about to be installed and make sure to order
     them appropriately.  For each repository about to be installed, if required repositories are not contained
     in the list of repositories about to be installed, then they are not considered.  Repository dependency
     definitions that contain circular dependencies should not result in an infinite loop, but obviously prior
     installation will not be handled for one or more of the repositories that require prior installation.  This
     process is similar to the process used when installing tool shed repositories, but does not handle managing
     tool panel sections and other components since repository dependency definitions contained in tool shed
     repositories with migrated tools must never define a relationship to a repository dependency that contains
     a tool.
     """
     ordered_tool_shed_repositories = []
     ordered_tsr_ids = []
     processed_tsr_ids = []
     prior_install_required_dict = self.get_prior_install_required_dict( tool_shed_repositories, repository_dependencies_dict )
     tsr_ids = [ tool_shed_repository.id for tool_shed_repository in tool_shed_repositories ]
     while len( processed_tsr_ids ) != len( prior_install_required_dict.keys() ):
         tsr_id = suc.get_next_prior_import_or_install_required_dict_entry( prior_install_required_dict, processed_tsr_ids )
         processed_tsr_ids.append( tsr_id )
         # Create the ordered_tsr_ids, the ordered_repo_info_dicts and the ordered_tool_panel_section_keys lists.
         if tsr_id not in ordered_tsr_ids:
             prior_install_required_ids = prior_install_required_dict[ tsr_id ]
             for prior_install_required_id in prior_install_required_ids:
                 if prior_install_required_id not in ordered_tsr_ids:
                     # Install the associated repository dependency first.
                     ordered_tsr_ids.append( prior_install_required_id )
             ordered_tsr_ids.append( tsr_id )
     for ordered_tsr_id in ordered_tsr_ids:
         for tool_shed_repository in tool_shed_repositories:
             if tool_shed_repository.id == ordered_tsr_id:
                 ordered_tool_shed_repositories.append( tool_shed_repository )
                 break
     return ordered_tool_shed_repositories
コード例 #2
0
 def order_repositories_for_installation( self, tool_shed_repositories, repository_dependencies_dict ):
     """
     Some repositories may have repository dependencies that are required to be installed before the dependent
     repository.  This method will inspect the list of repositories about to be installed and make sure to order
     them appropriately.  For each repository about to be installed, if required repositories are not contained
     in the list of repositories about to be installed, then they are not considered.  Repository dependency
     definitions that contain circular dependencies should not result in an infinite loop, but obviously prior
     installation will not be handled for one or more of the repositories that require prior installation.  This
     process is similar to the process used when installing tool shed repositories, but does not handle managing
     tool panel sections and other components since repository dependency definitions contained in tool shed
     repositories with migrated tools must never define a relationship to a repository dependency that contains
     a tool.
     """
     ordered_tool_shed_repositories = []
     ordered_tsr_ids = []
     processed_tsr_ids = []
     prior_install_required_dict = self.get_prior_install_required_dict( tool_shed_repositories, repository_dependencies_dict )
     while len( processed_tsr_ids ) != len( prior_install_required_dict.keys() ):
         tsr_id = suc.get_next_prior_import_or_install_required_dict_entry( prior_install_required_dict, processed_tsr_ids )
         processed_tsr_ids.append( tsr_id )
         # Create the ordered_tsr_ids, the ordered_repo_info_dicts and the ordered_tool_panel_section_keys lists.
         if tsr_id not in ordered_tsr_ids:
             prior_install_required_ids = prior_install_required_dict[ tsr_id ]
             for prior_install_required_id in prior_install_required_ids:
                 if prior_install_required_id not in ordered_tsr_ids:
                     # Install the associated repository dependency first.
                     ordered_tsr_ids.append( prior_install_required_id )
             ordered_tsr_ids.append( tsr_id )
     for ordered_tsr_id in ordered_tsr_ids:
         for tool_shed_repository in tool_shed_repositories:
             if tool_shed_repository.id == ordered_tsr_id:
                 ordered_tool_shed_repositories.append( tool_shed_repository )
                 break
     return ordered_tool_shed_repositories
コード例 #3
0
def order_components_for_import( trans, repository_ids, repo_info_dicts ):
    """
    Some repositories may have repository dependencies that must be imported and have metadata set on them before the dependent repository is imported.  This method
    will inspect the list of repositories about to be exported and make sure to order them appropriately for proper import.  For each repository about to be exported,
    if required repositories are not contained in the list of repositories about to be exported, then they are not considered.  Repository dependency definitions that
    contain circular dependencies should not result in an infinite loop, but obviously ordering the list will not be handled for one or more of the repositories that
    require prior import.
    """
    ordered_repository_ids = []
    ordered_repositories = []
    ordered_changeset_revisions = []
    # Create a dictionary whose keys are the received repository_ids and whose values are a list of repository_ids, each of which is contained in the received list of
    # repository_ids and whose associated repository must be imported prior to the repository associated with the repository_id key.
    prior_import_required_dict = suc.get_prior_import_or_install_required_dict( trans, repository_ids, repo_info_dicts )
    processed_repository_ids = []
    while len( processed_repository_ids ) != len( prior_import_required_dict.keys() ):
        repository_id = suc.get_next_prior_import_or_install_required_dict_entry( prior_import_required_dict, processed_repository_ids )
        processed_repository_ids.append( repository_id )
        if repository_id not in ordered_repository_ids:
            prior_import_required_ids = prior_import_required_dict[ repository_id ]
            for prior_import_required_id in prior_import_required_ids:
                if prior_import_required_id not in ordered_repository_ids:
                    # Import the associated repository dependency first.
                    prior_repo_info_dict = get_repo_info_dict_for_import( prior_import_required_id, repository_ids, repo_info_dicts )
                    prior_repository, prior_import_changeset_revision = get_components_from_repo_info_dict( trans, prior_repo_info_dict )
                    if prior_repository and prior_import_changeset_revision:
                        ordered_repository_ids.append( prior_import_required_id )
                        ordered_repositories.append( prior_repository )
                        ordered_changeset_revisions.append( prior_import_changeset_revision )
            repo_info_dict = get_repo_info_dict_for_import( repository_id, repository_ids, repo_info_dicts )
            repository, changeset_revision = get_components_from_repo_info_dict( trans, repo_info_dict )
            if repository and changeset_revision:
                ordered_repository_ids.append( repository_id )
                ordered_repositories.append( repository )
                ordered_changeset_revisions.append( changeset_revision )
    return ordered_repository_ids, ordered_repositories, ordered_changeset_revisions