1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/4f4875265599/ changeset: 4f4875265599 user: greg date: 2012-12-25 17:49:39 summary: Display installed repository dependencies in a separate container from missing repository dependencies. affected #: 7 files diff -r a3915a264f6c3ae7cec12778b3c3e7794ca5a8e8 -r 4f4875265599424fed16f35dd82eb785167f6c25 lib/galaxy/model/__init__.py --- a/lib/galaxy/model/__init__.py +++ b/lib/galaxy/model/__init__.py @@ -3167,40 +3167,40 @@ def has_readme_files( self ): return self.metadata and 'readme_files' in self.metadata @property - def required_repositories( self ): + def repository_dependencies( self ): required_repositories = [] - for rrda in self.repository_dependencies: + for rrda in self.required_repositories: repository_dependency = rrda.repository_dependency required_repository = repository_dependency.repository required_repositories.append( required_repository ) return required_repositories @property - def installed_required_repositories( self ): + def installed_repository_dependencies( self ): """Return the repository's repository dependencies that are currently installed.""" installed_required_repositories = [] - for required_repository in self.required_repositories: + for required_repository in self.repository_dependencies: if required_repository.status == self.installation_status.INSTALLED: installed_required_repositories.append( required_repository ) return installed_required_repositories @property - def missing_required_repositories( self ): + def missing_repository_dependencies( self ): """Return the repository's repository dependencies that are not currently installed, and may not ever have been installed.""" missing_required_repositories = [] - for required_repository in self.required_repositories: + for required_repository in self.repository_dependencies: if required_repository.status not in [ self.installation_status.INSTALLED ]: missing_required_repositories.append( required_repository ) return missing_required_repositories @property - def required_repositories_being_installed( self ): + def repository_dependencies_being_installed( self ): required_repositories_being_installed = [] - for required_repository in self.required_repositories: + for required_repository in self.repository_dependencies: if tool_dependency.status == ToolDependency.installation_status.INSTALLING: required_repositories_being_installed.append( required_repository ) return required_repositories_being_installed @property - def required_repositories_missing_or_being_installed( self ): + def repository_dependencies_missing_or_being_installed( self ): required_repositories_missing_or_being_installed = [] - for required_repository in self.required_repositories: + for required_repository in self.repository_dependencies: if required_repository.status in [ self.installation_status.ERROR, self.installation_status.INSTALLING, self.installation_status.NEVER_INSTALLED, @@ -3208,17 +3208,17 @@ required_repositories_missing_or_being_installed.append( required_repository ) return required_repositories_missing_or_being_installed @property - def required_repositories_with_installation_errors( self ): + def repository_dependencies_with_installation_errors( self ): required_repositories_with_installation_errors = [] - for required_repository in self.required_repositories: + for required_repository in self.repository_dependencies: if required_repository.status == self.installation_status.ERROR: required_repositories_with_installation_errors.append( required_repository ) return required_repositories_with_installation_errors @property - def uninstalled_required_repositories( self ): + def uninstalled_repository_dependencies( self ): """Return the repository's repository dependencies that have been uninstalled.""" uninstalled_required_repositories = [] - for required_repository in self.required_repositories: + for required_repository in self.repository_dependencies: if required_repository.status == self.installation_status.UNINSTALLED: uninstalled_required_repositories.append( required_repository ) return uninstalled_required_repositories diff -r a3915a264f6c3ae7cec12778b3c3e7794ca5a8e8 -r 4f4875265599424fed16f35dd82eb785167f6c25 lib/galaxy/model/mapping.py --- a/lib/galaxy/model/mapping.py +++ b/lib/galaxy/model/mapping.py @@ -1758,8 +1758,8 @@ primaryjoin=( ToolShedRepository.table.c.id == ToolDependency.table.c.tool_shed_repository_id ), order_by=ToolDependency.table.c.name, backref='tool_shed_repository' ), - repository_dependencies=relation( RepositoryRepositoryDependencyAssociation, - primaryjoin=( ToolShedRepository.table.c.id == RepositoryRepositoryDependencyAssociation.table.c.tool_shed_repository_id ) ) ) ) + required_repositories=relation( RepositoryRepositoryDependencyAssociation, + primaryjoin=( ToolShedRepository.table.c.id == RepositoryRepositoryDependencyAssociation.table.c.tool_shed_repository_id ) ) ) ) assign_mapper( context, RepositoryRepositoryDependencyAssociation, RepositoryRepositoryDependencyAssociation.table, properties=dict( repository=relation( ToolShedRepository, diff -r a3915a264f6c3ae7cec12778b3c3e7794ca5a8e8 -r 4f4875265599424fed16f35dd82eb785167f6c25 lib/galaxy/util/shed_util.py --- a/lib/galaxy/util/shed_util.py +++ b/lib/galaxy/util/shed_util.py @@ -488,6 +488,40 @@ if idx == count: break return headers +def get_installed_and_missing_repository_dependencies( trans, repository ): + missing_repository_dependencies = {} + installed_repository_dependencies = {} + if repository.has_repository_dependencies: + metadata = repository.metadata + installed_rd_tups = [] + missing_rd_tups = [] + # 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. + for rd in repository.repository_dependencies: + rd_tup = [ rd.tool_shed, rd.name, rd.owner, rd.changeset_revision, rd.id, rd.status ] + if rd.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 ) + 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_tool_dependencies( trans, repository, all_tool_dependencies ): if all_tool_dependencies: tool_dependencies = {} @@ -861,8 +895,11 @@ """ metadata = repository.metadata if metadata: + # Handle proprietary datatypes. datatypes = metadata.get( 'datatypes', None ) + # Handle invalid tools. invalid_tools = metadata.get( 'invalid_tools', None ) + # Handle README files. if repository.has_readme_files: if reinstalling: # Since we're reinstalling, we need to sned a request to the tool shed to get the README files. @@ -877,33 +914,20 @@ readme_files_dict = suc.build_readme_files_dict( repository.metadata, tool_path ) else: readme_files_dict = None - repository_dependencies_dict_for_display = {} - if repository.has_repository_dependencies: - rd_tups = [] - # We need to add a root_key entry to the 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 ) - # 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. - for rr in repository.required_repositories: - rd_tup = [ rr.tool_shed, rr.name, rr.owner, rr.changeset_revision, rr.id, rr.status ] - rd_tups.append( rd_tup ) - repository_dependencies_dict_for_display[ 'root_key' ] = root_key - repository_dependencies_dict_for_display[ root_key ] = rd_tups - # Get the description from the metadata in case it has a value. - repository_dependencies = metadata.get( 'repository_dependencies', {} ) - repository_dependencies_dict_for_display[ 'description' ] = repository_dependencies.get( 'description', None ) + # Handle repository dependencies. + installed_repository_dependencies, missing_repository_dependencies = get_installed_and_missing_repository_dependencies( trans, repository ) + # Handle tool dependencies. all_tool_dependencies = metadata.get( 'tool_dependencies', None ) - tool_dependencies, missing_tool_dependencies = get_installed_and_missing_tool_dependencies( trans, repository, all_tool_dependencies ) + installed_tool_dependencies, missing_tool_dependencies = get_installed_and_missing_tool_dependencies( trans, repository, all_tool_dependencies ) if reinstalling: # All tool dependencies will be considered missing since we are reinstalling the repository. - if tool_dependencies: - for td in tool_dependencies: + if installed_tool_dependencies: + for td in installed_tool_dependencies: missing_tool_dependencies.append( td ) - tool_dependencies = None + installed_tool_dependencies = None + # Handle valid tools. valid_tools = metadata.get( 'tools', None ) + # Handle workflows. workflows = metadata.get( 'workflows', None ) containers_dict = suc.build_repository_containers_for_galaxy( trans=trans, toolshed_base_url=tool_shed_url, @@ -913,10 +937,11 @@ repository=repository, datatypes=datatypes, invalid_tools=invalid_tools, + missing_repository_dependencies=missing_repository_dependencies, missing_tool_dependencies=missing_tool_dependencies, readme_files_dict=readme_files_dict, - repository_dependencies=repository_dependencies_dict_for_display, - tool_dependencies=tool_dependencies, + repository_dependencies=installed_repository_dependencies, + tool_dependencies=installed_tool_dependencies, valid_tools=valid_tools, workflows=workflows ) else: diff -r a3915a264f6c3ae7cec12778b3c3e7794ca5a8e8 -r 4f4875265599424fed16f35dd82eb785167f6c25 lib/galaxy/util/shed_util_common.py --- a/lib/galaxy/util/shed_util_common.py +++ b/lib/galaxy/util/shed_util_common.py @@ -76,14 +76,15 @@ log.debug( "Error reading README file '%s' defined in metadata: %s" % ( str( relative_path_to_readme_file ), str( e ) ) ) return readme_files_dict def build_repository_containers_for_galaxy( trans, toolshed_base_url, repository_name, repository_owner, changeset_revision, repository, datatypes, - invalid_tools, missing_tool_dependencies, readme_files_dict, repository_dependencies, tool_dependencies, - valid_tools, workflows ): + invalid_tools, missing_repository_dependencies, missing_tool_dependencies, readme_files_dict, + repository_dependencies, tool_dependencies, valid_tools, workflows ): """Return a dictionary of containers for the received repository's dependencies and readme files for display during installation to Galaxy.""" containers_dict = dict( datatypes=None, invalid_tools=None, missing_tool_dependencies=None, readme_files=None, repository_dependencies=None, + missing_repository_dependencies=None, tool_dependencies=None, valid_tools=None, workflows=None ) @@ -121,7 +122,7 @@ if readme_files_dict: folder_id, readme_files_root_folder = container_util.build_readme_files_folder( trans, folder_id, readme_files_dict ) containers_dict[ 'readme_files' ] = readme_files_root_folder - # Repository dependencies container. + # Installed repository dependencies container. if repository_dependencies: folder_id, repository_dependencies_root_folder = container_util.build_repository_dependencies_folder( trans=trans, toolshed_base_url=toolshed_base_url, @@ -129,16 +130,31 @@ repository_owner=repository_owner, changeset_revision=changeset_revision, folder_id=folder_id, - repository_dependencies=repository_dependencies ) + repository_dependencies=repository_dependencies, + label='Installed repository dependencies', + installed=True ) containers_dict[ 'repository_dependencies' ] = repository_dependencies_root_folder - # Tool dependencies container. + # Missing repository dependencies container. + if missing_repository_dependencies: + folder_id, missing_repository_dependencies_root_folder = \ + container_util.build_repository_dependencies_folder( trans=trans, + toolshed_base_url=toolshed_base_url, + repository_name=repository_name, + repository_owner=repository_owner, + changeset_revision=changeset_revision, + folder_id=folder_id, + repository_dependencies=missing_repository_dependencies, + label='Missing repository dependencies', + installed=False ) + containers_dict[ 'missing_repository_dependencies' ] = missing_repository_dependencies_root_folder + # Installed tool dependencies container. if tool_dependencies: # We only want to display the Status column if the tool_dependency is missing. folder_id, tool_dependencies_root_folder = container_util.build_tool_dependencies_folder( trans, folder_id, tool_dependencies, label='Installed tool dependencies', - display_status=False ) + installed=True ) containers_dict[ 'tool_dependencies' ] = tool_dependencies_root_folder # Missing tool dependencies container. if missing_tool_dependencies: @@ -147,7 +163,7 @@ folder_id, missing_tool_dependencies, label='Missing tool dependencies', - display_status=True ) + installed=False ) containers_dict[ 'missing_tool_dependencies' ] = missing_tool_dependencies_root_folder # Valid tools container. if valid_tools: @@ -210,7 +226,9 @@ repository_owner=repository.user.username, changeset_revision=changeset_revision, folder_id=folder_id, - repository_dependencies=repository_dependencies ) + repository_dependencies=repository_dependencies, + label='Repository dependencies', + installed=False ) if repository_dependencies_root_folder: containers_dict[ 'repository_dependencies' ] = repository_dependencies_root_folder # Tool dependencies container. @@ -219,7 +237,7 @@ folder_id, tool_dependencies_root_folder = container_util.build_tool_dependencies_folder( trans, folder_id, tool_dependencies, - display_status=False ) + installed=False ) containers_dict[ 'tool_dependencies' ] = tool_dependencies_root_folder # Valid tools container. if metadata and 'tools' in metadata: diff -r a3915a264f6c3ae7cec12778b3c3e7794ca5a8e8 -r 4f4875265599424fed16f35dd82eb785167f6c25 lib/galaxy/webapps/community/util/container_util.py --- a/lib/galaxy/webapps/community/util/container_util.py +++ b/lib/galaxy/webapps/community/util/container_util.py @@ -201,7 +201,7 @@ readme_files_root_folder = None return folder_id, readme_files_root_folder def build_repository_dependencies_folder( trans, toolshed_base_url, repository_name, repository_owner, changeset_revision, folder_id, repository_dependencies, - label='Repository dependencies' ): + label='Repository dependencies', installed=False ): """Return a folder hierarchy containing repository dependencies.""" if repository_dependencies: repository_dependency_id = 0 @@ -274,8 +274,11 @@ else: tools_root_folder = None return folder_id, tools_root_folder -def build_tool_dependencies_folder( trans, folder_id, tool_dependencies, label='Tool dependencies', display_status=False ): +def build_tool_dependencies_folder( trans, folder_id, tool_dependencies, label='Tool dependencies', installed=False ): """Return a folder hierarchy containing tool dependencies.""" + # The status will be displayed only if the values of the received installed is False. When this is the case, we're in Galaxy + # (not the tool shed), and the tool dependencies are not installed or are in an error state, so they are considered missing. + # The tool dependency status will be displayed only if the tool dependency is not installed. if tool_dependencies: tool_dependency_id = 0 folder_id += 1 @@ -283,11 +286,10 @@ folder_id += 1 folder = Folder( id=folder_id, key='tool_dependencies', label=label, parent=tool_dependencies_root_folder ) if trans.webapp.name == 'galaxy': - if display_status: - # The status will be displayed only if the tool dependency status is not 'Installed'. + if installed: + folder.description = 'click the name to browse the dependency installation directory' + else: folder.description = 'click the name to install the missing dependency' - else: - folder.description = 'click the name to browse the dependency installation directory' tool_dependencies_root_folder.folders.append( folder ) # Insert a header row. tool_dependency_id += 1 @@ -297,17 +299,15 @@ name='Name', version='Version', type='Type' ) - if display_status: + if installed: + tool_dependency.install_dir = 'Install directory' + else: tool_dependency.installation_status = 'Status' - else: - tool_dependency.install_dir = 'Install directory' else: tool_dependency = ToolDependency( id=tool_dependency_id, name='Name', version='Version', type='Type' ) - if display_status: - tool_dependency.installation_status = 'Status' folder.tool_dependencies.append( tool_dependency ) for dependency_key, requirements_dict in tool_dependencies.items(): tool_dependency_id += 1 @@ -317,7 +317,7 @@ type = set_environment_dict[ 'type' ] repository_id = set_environment_dict.get( 'repository_id', None ) td_id = set_environment_dict.get( 'tool_dependency_id', None ) - if display_status: + if trans.webapp.name == 'galaxy': installation_status = set_environment_dict.get( 'status', None ) else: installation_status = None @@ -335,7 +335,7 @@ install_dir = requirements_dict.get( 'install_dir', None ) repository_id = requirements_dict.get( 'repository_id', None ) td_id = requirements_dict.get( 'tool_dependency_id', None ) - if display_status: + if trans.webapp.name == 'galaxy': installation_status = requirements_dict.get( 'status', None ) else: installation_status = None diff -r a3915a264f6c3ae7cec12778b3c3e7794ca5a8e8 -r 4f4875265599424fed16f35dd82eb785167f6c25 lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py --- a/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py +++ b/lib/galaxy/webapps/galaxy/controllers/admin_toolshed.py @@ -44,7 +44,7 @@ elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.DEACTIVATED ]: bgcolor = trans.model.ToolShedRepository.states.WARNING elif tool_shed_repository.status in [ trans.model.ToolShedRepository.installation_status.INSTALLED ]: - if tool_shed_repository.missing_required_repositories: + if tool_shed_repository.missing_repository_dependencies: bgcolor = trans.model.ToolShedRepository.states.WARNING status_label = '%s, missing repository dependencies' % status_label elif tool_shed_repository.missing_tool_dependencies: @@ -1202,6 +1202,7 @@ repository=None, datatypes=None, invalid_tools=None, + missing_repository_dependencies=None, missing_tool_dependencies=None, readme_files_dict=readme_files_dict, repository_dependencies=repository_dependencies, diff -r a3915a264f6c3ae7cec12778b3c3e7794ca5a8e8 -r 4f4875265599424fed16f35dd82eb785167f6c25 templates/webapps/community/repository/common.mako --- a/templates/webapps/community/repository/common.mako +++ b/templates/webapps/community/repository/common.mako @@ -472,15 +472,18 @@ <${cell_type} style="padding-left: ${pad+20}px;"> %if row_is_header: ${tool_dependency.name | h} - %elif trans.webapp.name == 'galaxy' and tool_dependency.tool_dependency_id and tool_dependency.repository_id and not tool_dependency.installation_status: - ## tool_dependency.installation_status will be None if the status value in the database is 'Installed'. - <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='browse_tool_dependency', id=trans.security.encode_id( tool_dependency.tool_dependency_id ), repository_id=trans.security.encode_id( tool_dependency.repository_id ) )}"> + %elif trans.webapp.name == 'galaxy' and tool_dependency.tool_dependency_id: + %if tool_dependency.repository_id and tool_dependency.installation_status == 'Installed': + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='browse_tool_dependency', id=trans.security.encode_id( tool_dependency.tool_dependency_id ), repository_id=trans.security.encode_id( tool_dependency.repository_id ) )}"> + ${tool_dependency.name | h} + </a> + %elif tool_dependency.installation_status != 'Installed': + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_tool_dependencies', id=trans.security.encode_id( tool_dependency.tool_dependency_id ) )}"> + ${tool_dependency.name} + </a> + %else: ${tool_dependency.name | h} - </a> - %elif trans.webapp.name == 'galaxy' and tool_dependency.tool_dependency_id and tool_dependency.installation_status: - <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_tool_dependencies', id=trans.security.encode_id( tool_dependency.tool_dependency_id ) )}"> - ${tool_dependency.name} - </a> + %endif %else: ${tool_dependency.name | h} %endif @@ -551,6 +554,7 @@ invalid_tools_root_folder = containers_dict.get( 'invalid_tools', None ) readme_files_root_folder = containers_dict.get( 'readme_files', None ) repository_dependencies_root_folder = containers_dict.get( 'repository_dependencies', None ) + missing_repository_dependencies_root_folder = containers_dict.get( 'missing_repository_dependencies', None ) tool_dependencies_root_folder = containers_dict.get( 'tool_dependencies', None ) missing_tool_dependencies_root_folder = containers_dict.get( 'missing_tool_dependencies', None ) valid_tools_root_folder = containers_dict.get( 'valid_tools', none ) @@ -578,10 +582,17 @@ </div></div> %endif - %if repository_dependencies_root_folder or tool_dependencies_root_folder or missing_tool_dependencies_root_folder: + %if missing_repository_dependencies_root_folder or repository_dependencies_root_folder or tool_dependencies_root_folder or missing_tool_dependencies_root_folder: <div class="toolForm"><div class="toolFormTitle">Dependencies of this repository</div><div class="toolFormBody"> + %if missing_repository_dependencies_root_folder: + <p/> + <% row_counter = RowCounter() %> + <table cellspacing="2" cellpadding="2" border="0" width="100%" class="tables container-table" id="missing_repository_dependencies"> + ${render_folder( missing_repository_dependencies_root_folder, 0, parent=None, row_counter=row_counter, is_root_folder=True )} + </table> + %endif %if repository_dependencies_root_folder: <p/><% row_counter = RowCounter() %> Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.