1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/changeset/b268bc0bbc63/ changeset: b268bc0bbc63 user: greg date: 2012-12-21 18:35:28 summary: Fixes and enhancemensts for rendering simple repository dependencies for tools hed repository installed into a Galaxy instance. affected #: 6 files diff -r 5e60f799a8687d92fb41dd8a764d434623837772 -r b268bc0bbc63f525a981547d06c20911f553f1b2 lib/galaxy/util/shed_util.py --- a/lib/galaxy/util/shed_util.py +++ b/lib/galaxy/util/shed_util.py @@ -853,7 +853,7 @@ if k not in [ 'id', 'version', 'name' ]: return True return False -def populate_containers_dict_from_repository_metadata( trans, tool_shed_url, tool_path, repository ): +def populate_containers_dict_from_repository_metadata( trans, tool_shed_url, tool_path, repository, reinstalling=False ): """ Retrieve necessary information from the received repository's metadata to populate the containers_dict for display. This methos is called only from Galaxy and not the tool shed. @@ -863,25 +863,64 @@ datatypes = metadata.get( 'datatypes', None ) invalid_tools = metadata.get( 'invalid_tools', None ) if repository.has_readme_files: - readme_files_dict = suc.build_readme_files_dict( repository.metadata, tool_path ) + if reinstalling: + # Since we're reinstalling, we need to sned a request to the tool shed to get the README files. + url = suc.url_join( tool_shed_url, + 'repository/get_readme_files?name=%s&owner=%s&changeset_revision=%s' % \ + ( repository.name, repository.owner, repository.installed_changeset_revision ) ) + response = urllib2.urlopen( url ) + raw_text = response.read() + response.close() + readme_files_dict = from_json_string( raw_text ) + else: + readme_files_dict = suc.build_readme_files_dict( repository.metadata, tool_path ) else: readme_files_dict = None repository_dependencies = metadata.get( 'repository_dependencies', None ) repository_dependencies_dict_for_display = {} if repository_dependencies: - # We need to add a root_key entry to the repository_dependencies dictionary since it will not be included in the installed tool - # shed repository metadata. + # We need to add a root_key entry to the repository_dependencies dictionary since it will not be included in the installed tool shed repository metadata. root_key = container_util.generate_repository_dependencies_key_for_repository( repository.tool_shed, repository.name, repository.owner, repository.installed_changeset_revision ) rd_tups_for_display = [] rd_tups = repository_dependencies[ 'repository_dependencies' ] + for index, rd_tup in enumerate( rd_tups ): + # Get the id and the installation status of the required repository. + tool_shed, name, owner, changeset_revision = rd_tup + required_repository = suc.get_repository_for_dependency_relationship( trans.app, tool_shed, name, owner, changeset_revision ) + # TODO: Since the changeset revision defined in the tool shed repository's repository_dependencies.xml file may have a changeset_revision + # value that is outdated, we ened to make a call to the tool shed get the update dchangeset revision if repository is still None here. + if required_repository: + rd_tup.append( required_repository.id ) + rd_tup.append( str( required_repository.status ) ) + else: + # See above TODO. For now, we'll take a short cut and attempt to find the repository by name and owner only. This will not work long + # term because multiple revisions of a reposiory with the same name and owner could be installed into a Galaxy instance. The long term + # fix is to call get_update_to_changeset_revision_and_ctx_rev( trans, repository ) for each required repository. + required_repository = trans.sa_session.query( trans.model.ToolShedRepository ) \ + .filter( and_( trans.model.ToolShedRepository.table.c.name == name, + trans.model.ToolShedRepository.table.c.owner == owner ) ) \ + .first() + if required_repository: + rd_tup.append( required_repository.id ) + rd_tup.append( str( required_repository.status ) ) + else: + rd_tup.append( None ) + rd_tup.append( None ) + rd_tups[ index ] = rd_tup repository_dependencies_dict_for_display[ 'root_key' ] = root_key repository_dependencies_dict_for_display[ root_key ] = rd_tups repository_dependencies_dict_for_display[ 'description' ] = repository_dependencies[ 'description' ] all_tool_dependencies = metadata.get( 'tool_dependencies', None ) 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: + missing_tool_dependencies.append( td ) + tool_dependencies = None valid_tools = metadata.get( 'tools', None ) workflows = metadata.get( 'workflows', None ) containers_dict = suc.build_repository_containers_for_galaxy( trans=trans, diff -r 5e60f799a8687d92fb41dd8a764d434623837772 -r b268bc0bbc63f525a981547d06c20911f553f1b2 lib/galaxy/util/shed_util_common.py --- a/lib/galaxy/util/shed_util_common.py +++ b/lib/galaxy/util/shed_util_common.py @@ -106,11 +106,12 @@ folder_id = 0 # Datatypes container. if datatypes: - folder_id, datatypes_root_folder = container_util.build_datatypes_folder( folder_id, datatypes ) + folder_id, datatypes_root_folder = container_util.build_datatypes_folder( trans, folder_id, datatypes ) containers_dict[ 'datatypes' ] = datatypes_root_folder # Invalid tools container. if invalid_tools: - folder_id, invalid_tools_root_folder = container_util.build_invalid_tools_folder( folder_id, + folder_id, invalid_tools_root_folder = container_util.build_invalid_tools_folder( trans, + folder_id, invalid_tools, changeset_revision, repository=repository, @@ -118,11 +119,12 @@ containers_dict[ 'invalid_tools' ] = invalid_tools_root_folder # Readme files container. if readme_files_dict: - folder_id, readme_files_root_folder = container_util.build_readme_files_folder( folder_id, 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. if repository_dependencies: - folder_id, repository_dependencies_root_folder = container_util.build_repository_dependencies_folder( toolshed_base_url=toolshed_base_url, + folder_id, 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, @@ -132,44 +134,40 @@ # Tool dependencies container. if tool_dependencies: # We only want to display the Status column if the tool_dependency is missing. - description = 'click the name to browse the dependency installation directory' - folder_id, tool_dependencies_root_folder = container_util.build_tool_dependencies_folder( folder_id, + folder_id, tool_dependencies_root_folder = container_util.build_tool_dependencies_folder( trans, + folder_id, tool_dependencies, label='Installed tool dependencies', - for_galaxy=True, - description=description, display_status=False ) containers_dict[ 'tool_dependencies' ] = tool_dependencies_root_folder # Missing tool dependencies container. if missing_tool_dependencies: - description = 'click the name to install the missing dependency' # We only want to display the Status column if the tool_dependency is missing. - folder_id, missing_tool_dependencies_root_folder = container_util.build_tool_dependencies_folder( folder_id, + folder_id, missing_tool_dependencies_root_folder = container_util.build_tool_dependencies_folder( trans, + folder_id, missing_tool_dependencies, label='Missing tool dependencies', - for_galaxy=True, - description=description, display_status=True ) containers_dict[ 'missing_tool_dependencies' ] = missing_tool_dependencies_root_folder # Valid tools container. if valid_tools: - folder_id, valid_tools_root_folder = container_util.build_tools_folder( folder_id, + folder_id, valid_tools_root_folder = container_util.build_tools_folder( trans, + folder_id, valid_tools, repository, changeset_revision, - label='Valid tools', - description='click the name to inspect the tool metadata' ) + label='Valid tools' ) containers_dict[ 'valid_tools' ] = valid_tools_root_folder # Workflows container. if workflows: - folder_id, workflows_root_folder = container_util.build_workflows_folder( folder_id, workflows, repository_metadata, label='Workflows' ) + folder_id, workflows_root_folder = container_util.build_workflows_folder( trans, folder_id, workflows, repository_metadata, label='Workflows' ) containers_dict[ 'workflows' ] = workflows_root_folder except Exception, e: log.debug( "Exception in build_repository_containers_for_galaxy: %s" % str( e ) ) finally: lock.release() return containers_dict -def build_repository_containers_for_tool_shed( repository, changeset_revision, repository_dependencies, repository_metadata ): +def build_repository_containers_for_tool_shed( trans, repository, changeset_revision, repository_dependencies, repository_metadata ): """Return a dictionary of containers for the received repository's dependencies and contents for display in the tool shed.""" containers_dict = dict( datatypes=None, invalid_tools=None, @@ -187,12 +185,13 @@ # Datatypes container. if metadata and 'datatypes' in metadata: datatypes = metadata[ 'datatypes' ] - folder_id, datatypes_root_folder = container_util.build_datatypes_folder( folder_id, datatypes ) + folder_id, datatypes_root_folder = container_util.build_datatypes_folder( trans, folder_id, datatypes ) containers_dict[ 'datatypes' ] = datatypes_root_folder # Invalid tools container. if metadata and 'invalid_tools' in metadata: invalid_tool_configs = metadata[ 'invalid_tools' ] - folder_id, invalid_tools_root_folder = container_util.build_invalid_tools_folder( folder_id, + folder_id, invalid_tools_root_folder = container_util.build_invalid_tools_folder( trans, + folder_id, invalid_tool_configs, changeset_revision, repository=repository, @@ -201,11 +200,12 @@ # Readme files container. if metadata and 'readme_files' in metadata: readme_files_dict = build_readme_files_dict( metadata ) - folder_id, readme_files_root_folder = container_util.build_readme_files_folder( folder_id, 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. toolshed_base_url = str( url_for( '/', qualified=True ) ).rstrip( '/' ) - folder_id, repository_dependencies_root_folder = container_util.build_repository_dependencies_folder( toolshed_base_url=toolshed_base_url, + folder_id, 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.user.username, changeset_revision=changeset_revision, @@ -216,16 +216,16 @@ # Tool dependencies container. if metadata and 'tool_dependencies' in metadata: tool_dependencies = metadata[ 'tool_dependencies' ] - folder_id, tool_dependencies_root_folder = container_util.build_tool_dependencies_folder( folder_id, + folder_id, tool_dependencies_root_folder = container_util.build_tool_dependencies_folder( trans, + folder_id, tool_dependencies, - for_galaxy=False, - description=None, display_status=False ) containers_dict[ 'tool_dependencies' ] = tool_dependencies_root_folder # Valid tools container. if metadata and 'tools' in metadata: valid_tools = metadata[ 'tools' ] - folder_id, valid_tools_root_folder = container_util.build_tools_folder( folder_id, + folder_id, valid_tools_root_folder = container_util.build_tools_folder( trans, + folder_id, valid_tools, repository, changeset_revision, @@ -234,7 +234,7 @@ # Workflows container. if metadata and 'workflows' in metadata: workflows = metadata[ 'workflows' ] - folder_id, workflows_root_folder = container_util.build_workflows_folder( folder_id, workflows, repository_metadata, label='Workflows' ) + folder_id, workflows_root_folder = container_util.build_workflows_folder( trans, folder_id, workflows, repository_metadata, label='Workflows' ) containers_dict[ 'workflows' ] = workflows_root_folder except Exception, e: log.debug( "Exception in build_repository_containers_for_tool_shed: %s" % str( e ) ) diff -r 5e60f799a8687d92fb41dd8a764d434623837772 -r b268bc0bbc63f525a981547d06c20911f553f1b2 lib/galaxy/webapps/community/controllers/repository.py --- a/lib/galaxy/webapps/community/controllers/repository.py +++ b/lib/galaxy/webapps/community/controllers/repository.py @@ -1850,7 +1850,7 @@ review_id = trans.security.encode_id( review.id ) else: review_id = None - containers_dict = suc.build_repository_containers_for_tool_shed( repository, changeset_revision, repository_dependencies, repository_metadata ) + containers_dict = suc.build_repository_containers_for_tool_shed( trans, repository, changeset_revision, repository_dependencies, repository_metadata ) return trans.fill_template( '/webapps/community/repository/manage_repository.mako', cntrller=cntrller, repo_name=repo_name, @@ -1953,7 +1953,7 @@ selected_value=changeset_revision, add_id_to_name=False, downloadable=False ) - containers_dict = suc.build_repository_containers_for_tool_shed( repository, changeset_revision, repository_dependencies, repository_metadata ) + containers_dict = suc.build_repository_containers_for_tool_shed( trans, repository, changeset_revision, repository_dependencies, repository_metadata ) return trans.fill_template( '/webapps/community/repository/preview_tools_in_changeset.mako', repository=repository, containers_dict=containers_dict, @@ -2481,7 +2481,7 @@ review_id = trans.security.encode_id( review.id ) else: review_id = None - containers_dict = suc.build_repository_containers_for_tool_shed( repository, changeset_revision, repository_dependencies, repository_metadata ) + containers_dict = suc.build_repository_containers_for_tool_shed( trans, repository, changeset_revision, repository_dependencies, repository_metadata ) return trans.fill_template( '/webapps/community/repository/view_repository.mako', cntrller=cntrller, repo=repo, diff -r 5e60f799a8687d92fb41dd8a764d434623837772 -r b268bc0bbc63f525a981547d06c20911f553f1b2 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 @@ -71,13 +71,14 @@ class RepositoryDependency( object ): """Repository dependency object""" - def __init__( self, id=None, toolshed=None, repository_name=None, repository_owner=None, changeset_revision=None, installation_status=None ): + def __init__( self, id=None, toolshed=None, repository_name=None, repository_owner=None, changeset_revision=None, installation_status=None, tool_shed_repository_id=None ): self.id = id self.toolshed = toolshed self.repository_name = repository_name self.repository_owner = repository_owner self.changeset_revision = changeset_revision self.installation_status = installation_status + self.tool_shed_repository_id = tool_shed_repository_id @property def listify( self ): return [ self.toolshed, self.repository_name, self.repository_owner, self.changeset_revision ] @@ -120,7 +121,7 @@ self.format_version = format_version self.annotation = annotation -def build_datatypes_folder( folder_id, datatypes, label='Datatypes', description=None ): +def build_datatypes_folder( trans, folder_id, datatypes, label='Datatypes' ): """Return a folder hierarchy containing datatypes.""" if datatypes: datatype_id = 0 @@ -128,8 +129,6 @@ datatypes_root_folder = Folder( id=folder_id, key='root', label='root', parent=None ) folder_id += 1 folder = Folder( id=folder_id, key='datatypes', label=label, parent=datatypes_root_folder ) - if description: - folder.description = description datatypes_root_folder.folders.append( folder ) # Insert a header row. datatype_id += 1 @@ -150,7 +149,7 @@ else: datatypes_root_folder = None return folder_id, datatypes_root_folder -def build_invalid_tools_folder( folder_id, invalid_tool_configs, changeset_revision, repository=None, label='Invalid tools', description=None ): +def build_invalid_tools_folder( trans, folder_id, invalid_tool_configs, changeset_revision, repository=None, label='Invalid tools' ): """Return a folder hierarchy containing invalid tools.""" # TODO: Should we display invalid tools on the tool panel selection page when installing the repository into Galaxy? if invalid_tool_configs: @@ -159,8 +158,6 @@ invalid_tools_root_folder = Folder( id=folder_id, key='root', label='root', parent=None ) folder_id += 1 folder = Folder( id=folder_id, key='invalid_tools', label=label, parent=invalid_tools_root_folder ) - if description: - folder.description = description invalid_tools_root_folder.folders.append( folder ) for invalid_tool_config in invalid_tool_configs: invalid_tool_id += 1 @@ -176,7 +173,7 @@ else: invalid_tools_root_folder = None return folder_id, invalid_tools_root_folder -def build_readme_files_folder( folder_id, readme_files_dict, label='Readme files', description=None ): +def build_readme_files_folder( trans, folder_id, readme_files_dict, label='Readme files' ): """Return a folder hierarchy containing readme text files.""" if readme_files_dict: multiple_readme_files = len( readme_files_dict ) > 1 @@ -186,8 +183,6 @@ if multiple_readme_files: folder_id += 1 readme_files_folder = Folder( id=folder_id, key='readme_files', label=label, parent=readme_files_root_folder ) - if description: - readme_files_folder.description = description readme_files_root_folder.folders.append( readme_files_folder ) for readme_file_name, readme_file_text in readme_files_dict.items(): readme_id += 1 @@ -205,8 +200,8 @@ else: readme_files_root_folder = None return folder_id, readme_files_root_folder -def build_repository_dependencies_folder( toolshed_base_url, repository_name, repository_owner, changeset_revision, folder_id, repository_dependencies, - label='Repository dependencies', description=None ): +def build_repository_dependencies_folder( trans, toolshed_base_url, repository_name, repository_owner, changeset_revision, folder_id, repository_dependencies, + label='Repository dependencies' ): """Return a folder hierarchy containing repository dependencies.""" if repository_dependencies: repository_dependency_id = 0 @@ -217,8 +212,6 @@ # Create the Repository dependencies folder and add it to the root folder. repository_dependencies_folder_key = repository_dependencies[ 'root_key' ] repository_dependencies_folder = Folder( id=folder_id, key=repository_dependencies_folder_key, label=label, parent=repository_dependencies_root_folder ) - if description: - repository_dependencies_folder.description = description del repository_dependencies[ 'root_key' ] # The received repository_dependencies is a dictionary with keys: 'root_key', 'description', and one or more repository_dependency keys. # We want the description value associated with the repository_dependencies_folder. @@ -226,12 +219,12 @@ repository_dependencies_root_folder.folders.append( repository_dependencies_folder ) del repository_dependencies[ 'description' ] repository_dependencies_folder, folder_id, repository_dependency_id = \ - populate_repository_dependencies_container( repository_dependencies_folder, repository_dependencies, folder_id, repository_dependency_id ) + populate_repository_dependencies_container( trans, repository_dependencies_folder, repository_dependencies, folder_id, repository_dependency_id ) repository_dependencies_folder = prune_repository_dependencies( repository_dependencies_folder ) else: repository_dependencies_root_folder = None return folder_id, repository_dependencies_root_folder -def build_tools_folder( folder_id, tool_dicts, repository, changeset_revision, valid=True, label='Valid tools', description=None ): +def build_tools_folder( trans, folder_id, tool_dicts, repository, changeset_revision, valid=True, label='Valid tools' ): """Return a folder hierarchy containing valid tools.""" if tool_dicts: tool_id = 0 @@ -239,8 +232,8 @@ tools_root_folder = Folder( id=folder_id, key='root', label='root', parent=None ) folder_id += 1 folder = Folder( id=folder_id, key='tools', label=label, parent=tools_root_folder ) - if description: - folder.description = description + if trans.webapp.name == 'galaxy': + folder.description = 'click the name to inspect the tool metadata' tools_root_folder.folders.append( folder ) # Insert a header row. tool_id += 1 @@ -281,7 +274,7 @@ else: tools_root_folder = None return folder_id, tools_root_folder -def build_tool_dependencies_folder( folder_id, tool_dependencies, label='Tool dependencies', for_galaxy=False, description=None, display_status=False ): +def build_tool_dependencies_folder( trans, folder_id, tool_dependencies, label='Tool dependencies', display_status=False ): """Return a folder hierarchy containing tool dependencies.""" if tool_dependencies: tool_dependency_id = 0 @@ -289,12 +282,16 @@ tool_dependencies_root_folder = Folder( id=folder_id, key='root', label='root', parent=None ) folder_id += 1 folder = Folder( id=folder_id, key='tool_dependencies', label=label, parent=tool_dependencies_root_folder ) - if description: - folder.description = description + if trans.webapp.name == 'galaxy': + if display_status: + # The status will be displayed only if the tool dependency status is not 'Installed'. + 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 - if for_galaxy: + if trans.webapp.name == 'galaxy': # Include the installation directory. tool_dependency = ToolDependency( id=tool_dependency_id, name='Name', @@ -354,7 +351,7 @@ else: tool_dependencies_root_folder = None return folder_id, tool_dependencies_root_folder -def build_workflows_folder( folder_id, workflows, repository_metadata, label='Workflows', description=None ): +def build_workflows_folder( trans, folder_id, workflows, repository_metadata, label='Workflows' ): """Return a folder hierarchy containing invalid tools.""" if workflows: workflow_id = 0 @@ -362,8 +359,6 @@ workflows_root_folder = Folder( id=folder_id, key='root', label='root', parent=None ) folder_id += 1 folder = Folder( id=folder_id, key='workflows', label=label, parent=workflows_root_folder ) - if description: - folder.description = description workflows_root_folder.folders.append( folder ) # Insert a header row. workflow_id += 1 @@ -436,7 +431,7 @@ repository_owner = items[ 2 ] changeset_revision = items[ 3 ] return toolshed_base_url, repository_name, repository_owner, changeset_revision -def handle_repository_dependencies_container_entry( repository_dependencies_folder, rd_key, rd_value, folder_id, repository_dependency_id, folder_keys ): +def handle_repository_dependencies_container_entry( trans, repository_dependencies_folder, rd_key, rd_value, folder_id, repository_dependency_id, folder_keys ): toolshed, repository_name, repository_owner, changeset_revision = get_components_from_key( rd_key ) folder = get_folder( repository_dependencies_folder, rd_key ) label = generate_repository_dependencies_folder_label_from_key( repository_name, repository_owner, changeset_revision, repository_dependencies_folder.key ) @@ -451,7 +446,25 @@ folder_id += 1 sub_folder = Folder( id=folder_id, key=rd_key, label=label, parent=repository_dependencies_folder ) repository_dependencies_folder.folders.append( sub_folder ) + if trans.webapp.name == 'galaxy': + # Insert a header row. + repository_dependency_id += 1 + repository_dependency = RepositoryDependency( id=repository_dependency_id, + repository_name='Name', + changeset_revision='Revision', + repository_owner='Owner', + installation_status='Installation status' ) + # Insert the header row into the folder. + sub_folder.repository_dependencies.append( repository_dependency ) for repository_dependency in rd_value: + if trans.webapp.name == 'galaxy': + # We have two extra items in the tuple, repository.id and repository.status. + tool_shed_repository_id = repository_dependency[ 4 ] + installation_status = repository_dependency[ 5 ] + repository_dependency = repository_dependency[ 0:4 ] + else: + tool_shed_repository_id = None + installation_status = None can_create_dependency = not is_subfolder_of( sub_folder, repository_dependency ) if can_create_dependency: toolshed, repository_name, repository_owner, changeset_revision = repository_dependency @@ -460,7 +473,9 @@ toolshed=toolshed, repository_name=repository_name, repository_owner=repository_owner, - changeset_revision=changeset_revision ) + changeset_revision=changeset_revision, + installation_status=installation_status, + tool_shed_repository_id=tool_shed_repository_id ) # Insert the repository_dependency into the folder. sub_folder.repository_dependencies.append( repository_dependency ) return repository_dependencies_folder, folder_id, repository_dependency_id @@ -474,11 +489,11 @@ def key_is_current_repositorys_key( repository_name, repository_owner, changeset_revision, key ): toolshed_base_url, key_name, key_owner, key_changeset_revision = get_components_from_key( key ) return repository_name == key_name and repository_owner == key_owner and changeset_revision == key_changeset_revision -def populate_repository_dependencies_container( repository_dependencies_folder, repository_dependencies, folder_id, repository_dependency_id ): +def populate_repository_dependencies_container( trans, repository_dependencies_folder, repository_dependencies, folder_id, repository_dependency_id ): folder_keys = repository_dependencies.keys() for key, value in repository_dependencies.items(): repository_dependencies_folder, folder_id, repository_dependency_id = \ - handle_repository_dependencies_container_entry( repository_dependencies_folder, key, value, folder_id, repository_dependency_id, folder_keys ) + handle_repository_dependencies_container_entry( trans, repository_dependencies_folder, key, value, folder_id, repository_dependency_id, folder_keys ) return repository_dependencies_folder, folder_id, repository_dependency_id def print_folders( pad, folder ): # For debugging... diff -r 5e60f799a8687d92fb41dd8a764d434623837772 -r b268bc0bbc63f525a981547d06c20911f553f1b2 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 @@ -877,7 +877,7 @@ trans.sa_session.add( repository ) trans.sa_session.flush() message = "The repository information has been updated." - containers_dict = shed_util.populate_containers_dict_from_repository_metadata( trans, tool_shed_url, tool_path, repository ) + containers_dict = shed_util.populate_containers_dict_from_repository_metadata( trans, tool_shed_url, tool_path, repository, reinstalling=False ) return trans.fill_template( '/admin/tool_shed_repository/manage_repository.mako', repository=repository, description=description, @@ -1409,6 +1409,7 @@ tool_shed_url = suc.get_url_from_repository_tool_shed( trans.app, tool_shed_repository ) ctx_rev = suc.get_ctx_rev( tool_shed_url, tool_shed_repository.name, tool_shed_repository.owner, tool_shed_repository.installed_changeset_revision ) repository_clone_url = suc.generate_clone_url_for_installed_repository( trans.app, tool_shed_repository ) + tool_path, relative_install_dir = tool_shed_repository.get_tool_relative_path( trans.app ) repository_dependencies = self.get_repository_dependencies( trans=trans, repository_id=repository_id, repository_name=tool_shed_repository.name, @@ -1457,66 +1458,7 @@ message += "The tools contained in your <b>%s</b> repository were last loaded into the tool panel outside of any sections. " % tool_shed_repository.name message += "Uncheck the <b>No changes</b> check box and select a tool panel section to load the tools into that section. " status = 'warning' - if metadata: - datatypes = metadata.get( 'datatypes', None ) - invalid_tools = metadata.get( 'invalid_tools', None ) - if tool_shed_repository.has_readme_files: - url = suc.url_join( tool_shed_url, - 'repository/get_readme_files?name=%s&owner=%s&changeset_revision=%s' % \ - ( tool_shed_repository.name, tool_shed_repository.owner, tool_shed_repository.installed_changeset_revision ) ) - response = urllib2.urlopen( url ) - raw_text = response.read() - response.close() - readme_files_dict = from_json_string( raw_text ) - else: - readme_files_dict = None - repository_dependencies = metadata.get( 'repository_dependencies', None ) - repository_dependencies_dict_for_display = {} - if repository_dependencies: - # We need to add a root_key entry to the repository_dependencies dictionary since it will not be included in the installed tool - # shed repository metadata. - root_key = container_util.generate_repository_dependencies_key_for_repository( tool_shed_repository.tool_shed, - tool_shed_repository.name, - tool_shed_repository.owner, - tool_shed_repository.installed_changeset_revision ) - rd_tups_for_display = [] - rd_tups = repository_dependencies[ 'repository_dependencies' ] - repository_dependencies_dict_for_display[ 'root_key' ] = root_key - repository_dependencies_dict_for_display[ root_key ] = rd_tups - repository_dependencies_dict_for_display[ 'description' ] = repository_dependencies[ 'description' ] - all_tool_dependencies = metadata.get( 'tool_dependencies', None ) - tool_dependencies, missing_tool_dependencies = shed_util.get_installed_and_missing_tool_dependencies( trans, - tool_shed_repository, - all_tool_dependencies ) - valid_tools = metadata.get( 'tools', None ) - workflows = metadata.get( 'workflows', None ) - # All tool dependencies will be considered missing since we are reinstalling the repository. - if tool_dependencies: - for td in tool_dependencies: - missing_tool_dependencies.append( td ) - tool_dependencies = None - containers_dict = suc.build_repository_containers_for_galaxy( trans=trans, - toolshed_base_url=tool_shed_url, - repository_name=tool_shed_repository.name, - repository_owner=tool_shed_repository.owner, - changeset_revision=tool_shed_repository.installed_changeset_revision, - repository=tool_shed_repository, - datatypes=datatypes, - invalid_tools=invalid_tools, - missing_tool_dependencies=missing_tool_dependencies, - readme_files_dict=readme_files_dict, - repository_dependencies=repository_dependencies, - tool_dependencies=missing_tool_dependencies, - valid_tools=valid_tools, - workflows=workflows ) - else: - containers_dict = dict( datatypes=None, - invalid_tools=None, - readme_files_dict=None, - repository_dependencies=None, - tool_dependencies=None, - valid_tools=None, - workflows=None ) + containers_dict = shed_util.populate_containers_dict_from_repository_metadata( trans, tool_shed_url, tool_path, tool_shed_repository, reinstalling=True ) # Handle repository dependencies check box. install_repository_dependencies_check_box = CheckboxField( 'install_repository_dependencies', checked=True ) # Handle tool dependencies check box. @@ -1656,7 +1598,7 @@ status = 'error' shed_tool_conf, tool_path, relative_install_dir = suc.get_tool_panel_config_tool_path_install_dir( trans.app, repository ) repo_files_dir = os.path.abspath( os.path.join( relative_install_dir, repository.name ) ) - containers_dict = shed_util.populate_containers_dict_from_repository_metadata( trans, tool_shed_url, tool_path, repository ) + containers_dict = shed_util.populate_containers_dict_from_repository_metadata( trans, tool_shed_url, tool_path, repository, reinstalling=False ) return trans.fill_template( '/admin/tool_shed_repository/manage_repository.mako', repository=repository, description=repository.description, diff -r 5e60f799a8687d92fb41dd8a764d434623837772 -r b268bc0bbc63f525a981547d06c20911f553f1b2 templates/webapps/community/repository/common.mako --- a/templates/webapps/community/repository/common.mako +++ b/templates/webapps/community/repository/common.mako @@ -214,6 +214,8 @@ folder_label = "%s<i> - %s</i>" % ( folder_label, folder.description ) else: folder_label = "%s<i> - this repository requires installation of these additional repositories</i>" % folder_label + if trans.webapp.name == 'galaxy': + col_span_str = 'colspan="4"' elif folder.label == 'Valid tools': col_span_str = 'colspan="3"' if folder.description: @@ -252,8 +254,9 @@ %for readme in folder.readme_files: ${render_readme( readme, pad, my_row, row_counter )} %endfor - %for repository_dependency in folder.repository_dependencies: - ${render_repository_dependency( repository_dependency, pad, my_row, row_counter )} + %for index, repository_dependency in enumerate( folder.repository_dependencies ): + <% row_is_header = index == 0 %> + ${render_repository_dependency( repository_dependency, pad, my_row, row_counter, row_is_header )} %endfor %for index, tool_dependency in enumerate( folder.tool_dependencies ): <% row_is_header = index == 0 %> @@ -349,21 +352,60 @@ %></%def> -<%def name="render_repository_dependency( repository_dependency, pad, parent, row_counter )"> +<%def name="render_repository_dependency( repository_dependency, pad, parent, row_counter, row_is_header=False )"><% encoded_id = trans.security.encode_id( repository_dependency.id ) + if trans.webapp.name == 'galaxy': + if repository_dependency.tool_shed_repository_id: + encoded_required_repository_id = trans.security.encode_id( repository_dependency.tool_shed_repository_id ) + else: + encoded_required_repository_id = None + if repository_dependency.installation_status: + installation_status = str( repository_dependency.installation_status ) + else: + installation_status = None repository_name = str( repository_dependency.repository_name ) changeset_revision = str( repository_dependency.changeset_revision ) repository_owner = str( repository_dependency.repository_owner ) + + if trans.webapp.name == 'galaxy': + if row_is_header: + cell_type = 'th' + else: + cell_type = 'td' + else: + cell_type = 'td' %><tr class="datasetRow" %if parent is not None: parent="${parent}" %endif id="libraryItem-${encoded_id}"> - ##<td style="padding-left: ${pad+20}px;">${repository_dependency.toolshed | h}</td> - <td style="padding-left: ${pad+20}px;">Repository <b>${repository_name | h}</b> revision <b>${changeset_revision | h}</b> owned by <b>${repository_owner | h}</b></td> + %if trans.webapp.name == 'galaxy': + <${cell_type} style="padding-left: ${pad+20}px;"> + %if row_is_header: + ${repository_name | h} + %elif encoded_required_repository_id: + <a class="action-button" href="${h.url_for( controller='admin_toolshed', action='manage_repository', id=encoded_required_repository_id )}">${repository_name | h}</a> + %else: + ${repository_name | h} + %endif + </${cell_type}> + <${cell_type}> + ${changeset_revision | h} + </${cell_type}> + <${cell_type}> + ${repository_owner | h} + </${cell_type}> + <${cell_type}> + ${installation_status} + </${cell_type}> + %else: + <td style="padding-left: ${pad+20}px;"> + Repository <b>${repository_name | h}</b> revision <b>${changeset_revision | h}</b> owned by <b>${repository_owner | h}</b> + </td> + %endif </tr><% my_row = row_counter.count 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.