def get_installed_and_missing_repository_dependencies( trans, repository ): """ Return the installed and missing repository dependencies for a tool shed repository that has a record in the Galaxy database, but may or may not be installed. In this case, the repository dependencies are associated with the repository in the database. """ missing_repository_dependencies = {} installed_repository_dependencies = {} has_repository_dependencies = repository.has_repository_dependencies if has_repository_dependencies: # The repository dependencies container will include only the immediate repository dependencies of this repository, so the container # will be only a single level in depth. metadata = repository.metadata installed_rd_tups = [] missing_rd_tups = [] for tsr in repository.repository_dependencies: prior_installation_required = suc.set_prior_installation_required( repository, tsr ) rd_tup = [ tsr.tool_shed, tsr.name, tsr.owner, tsr.changeset_revision, prior_installation_required, tsr.id, tsr.status ] if tsr.status == trans.model.ToolShedRepository.installation_status.INSTALLED: installed_rd_tups.append( rd_tup ) else: missing_rd_tups.append( rd_tup ) if installed_rd_tups or missing_rd_tups: # Get the description from the metadata in case it has a value. repository_dependencies = metadata.get( 'repository_dependencies', {} ) description = repository_dependencies.get( 'description', None ) # We need to add a root_key entry to one or both of installed_repository_dependencies dictionary and the missing_repository_dependencies # dictionary for proper display parsing. root_key = container_util.generate_repository_dependencies_key_for_repository( repository.tool_shed, repository.name, repository.owner, repository.installed_changeset_revision, prior_installation_required ) if installed_rd_tups: installed_repository_dependencies[ 'root_key' ] = root_key installed_repository_dependencies[ root_key ] = installed_rd_tups installed_repository_dependencies[ 'description' ] = description if missing_rd_tups: missing_repository_dependencies[ 'root_key' ] = root_key missing_repository_dependencies[ root_key ] = missing_rd_tups missing_repository_dependencies[ 'description' ] = description return installed_repository_dependencies, missing_repository_dependencies
def get_installed_and_missing_repository_dependencies( trans, repository ): """ Return the installed and missing repository dependencies for a tool shed repository that has a record in the Galaxy database, but may or may not be installed. In this case, the repository dependencies are associated with the repository in the database. Do not include a repository dependency if it is required only to compile a tool dependency defined for the dependent repository since these special kinds of repository dependencies are really a dependency of the dependent repository's contained tool dependency, and only if that tool dependency requires compilation. """ missing_repository_dependencies = {} installed_repository_dependencies = {} has_repository_dependencies = repository.has_repository_dependencies if has_repository_dependencies: # The repository dependencies container will include only the immediate repository dependencies of this repository, so the container # will be only a single level in depth. metadata = repository.metadata installed_rd_tups = [] missing_rd_tups = [] for tsr in repository.repository_dependencies: prior_installation_required = suc.set_prior_installation_required( repository, tsr ) only_if_compiling_contained_td = suc.set_only_if_compiling_contained_td( repository, tsr ) rd_tup = [ tsr.tool_shed, tsr.name, tsr.owner, tsr.changeset_revision, prior_installation_required, only_if_compiling_contained_td, tsr.id, tsr.status ] if tsr.status == trans.install_model.ToolShedRepository.installation_status.INSTALLED: installed_rd_tups.append( rd_tup ) else: # We'll only add the rd_tup to the missing_rd_tups list if the received repository has tool dependencies that are not # correctly installed. This may prove to be a weak check since the repository in question may not have anything to do # with compiling the missing tool dependencies. If we discover that this is a problem, more granular checking will be # necessary here. if repository.missing_tool_dependencies: if not repository_dependency_needed_only_for_compiling_tool_dependency( repository, tsr ): missing_rd_tups.append( rd_tup ) else: missing_rd_tups.append( rd_tup ) if installed_rd_tups or missing_rd_tups: # Get the description from the metadata in case it has a value. repository_dependencies = metadata.get( 'repository_dependencies', {} ) description = repository_dependencies.get( 'description', None ) # We need to add a root_key entry to one or both of installed_repository_dependencies dictionary and the # missing_repository_dependencies dictionaries for proper display parsing. root_key = container_util.generate_repository_dependencies_key_for_repository( repository.tool_shed, repository.name, repository.owner, repository.installed_changeset_revision, prior_installation_required, only_if_compiling_contained_td ) if installed_rd_tups: installed_repository_dependencies[ 'root_key' ] = root_key installed_repository_dependencies[ root_key ] = installed_rd_tups installed_repository_dependencies[ 'description' ] = description if missing_rd_tups: missing_repository_dependencies[ 'root_key' ] = root_key missing_repository_dependencies[ root_key ] = missing_rd_tups missing_repository_dependencies[ 'description' ] = description return installed_repository_dependencies, missing_repository_dependencies