2 new commits in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/97fd1b009c86/ Changeset: 97fd1b009c86 Branch: stable User: natefoo Date: 2014-01-14 17:31:11 Summary: Backed out changeset c40ecf876d68 Affected #: 4 files diff -r c40ecf876d68ed86ac874f9b8c4b4d0fcb9bc69e -r 97fd1b009c86ac992716ce6e81d45cb20c06a3c1 lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py --- a/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py +++ b/lib/galaxy/webapps/galaxy/api/tool_shed_repositories.py @@ -262,7 +262,7 @@ no_tool_dependency_dir_message = "Tool dependencies can be automatically installed only if you set the value of your 'tool_dependency_dir' " no_tool_dependency_dir_message += "setting in your Galaxy configuration file (universe_wsgi.ini) and restart your Galaxy server." raise HTTPBadRequest( detail=no_tool_dependency_dir_message ) - new_tool_panel_section_label = payload.get( 'new_tool_panel_section_label', '' ) + new_tool_panel_section = payload.get( 'new_tool_panel_section_label', '' ) shed_tool_conf = payload.get( 'shed_tool_conf', None ) if shed_tool_conf: # Get the tool_path setting. @@ -281,20 +281,15 @@ raise HTTPBadRequest( detail="Missing required parameter 'shed_tool_conf'." ) tool_panel_section_id = payload.get( 'tool_panel_section_id', '' ) if tool_panel_section_id not in [ None, '' ]: - if tool_panel_section_id not in trans.app.toolbox.tool_panel: - fixed_tool_panel_section_id = 'section_%s' % tool_panel_section_id - if fixed_tool_panel_section_id in trans.app.toolbox.tool_panel: - tool_panel_section_id = fixed_tool_panel_section_id - else: - tool_panel_section_id = '' + tool_panel_section = trans.app.toolbox.tool_panel[ tool_panel_section_id ] else: - tool_panel_section_id = '' + tool_panel_section = '' # Build the dictionary of information necessary for creating tool_shed_repository database records for each repository being installed. installation_dict = dict( install_repository_dependencies=install_repository_dependencies, - new_tool_panel_section_label=new_tool_panel_section_label, + new_tool_panel_section=new_tool_panel_section, no_changes_checked=False, repo_info_dicts=repo_info_dicts, - tool_panel_section_id=tool_panel_section_id, + tool_panel_section=tool_panel_section, tool_path=tool_path, tool_shed_url=tool_shed_url ) # Create the tool_shed_repository database records and gather additional information for repository installation. @@ -311,18 +306,17 @@ install_repository_dependencies=install_repository_dependencies, install_tool_dependencies=install_tool_dependencies, message='', - new_tool_panel_section_label=new_tool_panel_section_label, + new_tool_panel_section=new_tool_panel_section, shed_tool_conf=shed_tool_conf, status='done', - tool_panel_section_id=tool_panel_section_id, + tool_panel_section=tool_panel_section, tool_panel_section_keys=tool_panel_section_keys, tool_path=tool_path, tool_shed_url=tool_shed_url ) # Prepare the repositories for installation. Even though this method receives a single combination of tool_shed_url, name, owner and # changeset_revision, there may be multiple repositories for installation at this point because repository dependencies may have added # additional repositories for installation along with the single specified repository. - encoded_kwd, query, tool_shed_repositories, encoded_repository_ids = \ - repository_util.initiate_repository_installation( trans, installation_dict ) + encoded_kwd, query, tool_shed_repositories, encoded_repository_ids = repository_util.initiate_repository_installation( trans, installation_dict ) # Some repositories may have repository dependencies that are required to be installed before the dependent repository, so we'll # order the list of tsr_ids to ensure all repositories install in the required order. tsr_ids = [ trans.security.encode_id( tool_shed_repository.id ) for tool_shed_repository in tool_shed_repositories ] diff -r c40ecf876d68ed86ac874f9b8c4b4d0fcb9bc69e -r 97fd1b009c86ac992716ce6e81d45cb20c06a3c1 lib/tool_shed/galaxy_install/repository_util.py --- a/lib/tool_shed/galaxy_install/repository_util.py +++ b/lib/tool_shed/galaxy_install/repository_util.py @@ -244,10 +244,9 @@ tool_panel_section_id = section_dict[ 'id' ] tool_panel_section_name = section_dict[ 'name' ] if tool_panel_section_id: - tool_panel_section_key, tool_panel_section = \ - tool_util.get_or_create_tool_section( trans, - tool_panel_section_id=tool_panel_section_id, - new_tool_panel_section_label=tool_panel_section_name ) + tool_panel_section_key, tool_panel_section = tool_util.get_or_create_tool_section( trans, + tool_panel_section_id=tool_panel_section_id, + new_tool_panel_section=tool_panel_section_name ) else: tool_dependencies = None repo_info_dict = create_repo_info_dict( trans=trans, @@ -433,10 +432,10 @@ def handle_tool_shed_repositories( trans, installation_dict, using_api=False ): # The following installation_dict entries are all required. install_repository_dependencies = installation_dict[ 'install_repository_dependencies' ] - new_tool_panel_section_label = installation_dict[ 'new_tool_panel_section_label' ] + new_tool_panel_section = installation_dict[ 'new_tool_panel_section' ] no_changes_checked = installation_dict[ 'no_changes_checked' ] repo_info_dicts = installation_dict[ 'repo_info_dicts' ] - tool_panel_section_id = installation_dict[ 'tool_panel_section_id' ] + tool_panel_section = installation_dict[ 'tool_panel_section' ] tool_path = installation_dict[ 'tool_path' ] tool_shed_url = installation_dict[ 'tool_shed_url' ] created_or_updated_tool_shed_repositories, tool_panel_section_keys, repo_info_dicts, filtered_repo_info_dicts = \ @@ -446,8 +445,8 @@ repo_info_dicts=repo_info_dicts, install_repository_dependencies=install_repository_dependencies, no_changes_checked=no_changes_checked, - tool_panel_section_id=tool_panel_section_id, - new_tool_panel_section_label=new_tool_panel_section_label ) + tool_panel_section=tool_panel_section, + new_tool_panel_section=new_tool_panel_section ) return created_or_updated_tool_shed_repositories, tool_panel_section_keys, repo_info_dicts, filtered_repo_info_dicts def initiate_repository_installation( trans, installation_dict ): @@ -461,19 +460,18 @@ install_repository_dependencies = installation_dict[ 'install_repository_dependencies' ] install_tool_dependencies = installation_dict[ 'install_tool_dependencies' ] message = installation_dict[ 'message' ] - new_tool_panel_section_label = installation_dict[ 'new_tool_panel_section_label' ] + new_tool_panel_section = installation_dict[ 'new_tool_panel_section' ] shed_tool_conf = installation_dict[ 'shed_tool_conf' ] status = installation_dict[ 'status' ] - tool_panel_section_id = installation_dict[ 'tool_panel_section_id' ] + tool_panel_section = installation_dict[ 'tool_panel_section' ] tool_panel_section_keys = installation_dict[ 'tool_panel_section_keys' ] tool_path = installation_dict[ 'tool_path' ] tool_shed_url = installation_dict[ 'tool_shed_url' ] # Handle contained tools. - if includes_tools_for_display_in_tool_panel and ( new_tool_panel_section_label or tool_panel_section_id ): - tool_panel_section_key, tool_section = \ - tool_util.handle_tool_panel_section( trans, - tool_panel_section_id=tool_panel_section_id, - new_tool_panel_section_label=new_tool_panel_section_label ) + if includes_tools_for_display_in_tool_panel and ( new_tool_panel_section or tool_panel_section ): + tool_panel_section_key, tool_section = tool_util.handle_tool_panel_section( trans, + tool_panel_section=tool_panel_section, + new_tool_panel_section=new_tool_panel_section ) else: tool_panel_section_key = None tool_section = None @@ -671,19 +669,16 @@ def order_components_for_installation( trans, tsr_ids, repo_info_dicts, tool_panel_section_keys ): """ - 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. + 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. """ ordered_tsr_ids = [] ordered_repo_info_dicts = [] ordered_tool_panel_section_keys = [] - # Create a dictionary whose keys are the received tsr_ids and whose values are a list of tsr_ids, each of which is - # contained in the received list of tsr_ids and whose associated repository must be installed prior to the repository - # associated with the tsr_id key. + # Create a dictionary whose keys are the received tsr_ids and whose values are a list of tsr_ids, each of which is contained in the received list of tsr_ids + # and whose associated repository must be installed prior to the repository associated with the tsr_id key. prior_install_required_dict = suc.get_prior_import_or_install_required_dict( trans, tsr_ids, repo_info_dicts ) processed_tsr_ids = [] while len( processed_tsr_ids ) != len( prior_install_required_dict.keys() ): @@ -695,19 +690,17 @@ 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. - prior_repo_info_dict, prior_tool_panel_section_key = \ - get_repository_components_for_installation( prior_install_required_id, - tsr_ids, - repo_info_dicts, - tool_panel_section_keys=tool_panel_section_keys ) + prior_repo_info_dict, prior_tool_panel_section_key = get_repository_components_for_installation( prior_install_required_id, + tsr_ids, + repo_info_dicts, + tool_panel_section_keys=tool_panel_section_keys ) ordered_tsr_ids.append( prior_install_required_id ) ordered_repo_info_dicts.append( prior_repo_info_dict ) ordered_tool_panel_section_keys.append( prior_tool_panel_section_key ) - repo_info_dict, tool_panel_section_key = \ - get_repository_components_for_installation( tsr_id, - tsr_ids, - repo_info_dicts, - tool_panel_section_keys=tool_panel_section_keys ) + repo_info_dict, tool_panel_section_key = get_repository_components_for_installation( tsr_id, + tsr_ids, + repo_info_dicts, + tool_panel_section_keys=tool_panel_section_keys ) ordered_tsr_ids.append( tsr_id ) ordered_repo_info_dicts.append( repo_info_dict ) ordered_tool_panel_section_keys.append( tool_panel_section_key ) @@ -772,12 +765,11 @@ shed_tool_conf, tool_path, relative_install_dir = suc.get_tool_panel_config_tool_path_install_dir( trans.app, repository ) # Reset the repository attributes to the New state for installation. if metadata: - tool_section, tool_panel_section_key = \ - tool_util.handle_tool_panel_selection( trans, - metadata, - no_changes_checked=True, - tool_panel_section_id=None, - new_tool_panel_section_label=None ) + tool_section, new_tool_panel_section, tool_panel_section_key = tool_util.handle_tool_panel_selection( trans, + metadata, + no_changes_checked=True, + tool_panel_section=None, + new_tool_panel_section=None ) else: # The tools will be loaded outside of any sections in the tool panel. tool_panel_section_key = None diff -r c40ecf876d68ed86ac874f9b8c4b4d0fcb9bc69e -r 97fd1b009c86ac992716ce6e81d45cb20c06a3c1 lib/tool_shed/util/repository_dependency_util.py --- a/lib/tool_shed/util/repository_dependency_util.py +++ b/lib/tool_shed/util/repository_dependency_util.py @@ -96,7 +96,7 @@ return True def create_repository_dependency_objects( trans, tool_path, tool_shed_url, repo_info_dicts, install_repository_dependencies=False, - no_changes_checked=False, tool_panel_section_id=None, new_tool_panel_section_label=None ): + no_changes_checked=False, tool_panel_section=None, new_tool_panel_section=None ): """ Discover all repository dependencies and make sure all tool_shed_repository and associated repository_dependency records exist as well as the dependency relationships between installed repositories. This method is called when uninstalled repositories are being reinstalled. @@ -174,30 +174,28 @@ # The database record for the tool shed repository currently being processed can be updated. Get the repository metadata # to see where it was previously located in the tool panel. if repository_db_record and repository_db_record.metadata: - tool_section, tool_panel_section_key = \ + tool_section, new_tool_panel_section, tool_panel_section_key = \ tool_util.handle_tool_panel_selection( trans=trans, metadata=repository_db_record.metadata, no_changes_checked=no_changes_checked, - tool_panel_section_id=tool_panel_section_id, - new_tool_panel_section_label=new_tool_panel_section_label ) + tool_panel_section=tool_panel_section, + new_tool_panel_section=new_tool_panel_section ) else: # We're installing a new tool shed repository that does not yet have a database record. - tool_panel_section_key, tool_section = \ - tool_util.handle_tool_panel_section( trans, - tool_panel_section_id=tool_panel_section_id, - new_tool_panel_section_label=new_tool_panel_section_label ) - tool_shed_repository = \ - suc.create_or_update_tool_shed_repository( app=trans.app, - name=name, - description=description, - installed_changeset_revision=changeset_revision, - ctx_rev=ctx_rev, - repository_clone_url=repository_clone_url, - metadata_dict={}, - status=trans.model.ToolShedRepository.installation_status.NEW, - current_changeset_revision=changeset_revision, - owner=repository_owner, - dist_to_shed=False ) + tool_panel_section_key, tool_section = tool_util.handle_tool_panel_section( trans, + tool_panel_section=tool_panel_section, + new_tool_panel_section=new_tool_panel_section ) + tool_shed_repository = suc.create_or_update_tool_shed_repository( app=trans.app, + name=name, + description=description, + installed_changeset_revision=changeset_revision, + ctx_rev=ctx_rev, + repository_clone_url=repository_clone_url, + metadata_dict={}, + status=trans.model.ToolShedRepository.installation_status.NEW, + current_changeset_revision=changeset_revision, + owner=repository_owner, + dist_to_shed=False ) if tool_shed_repository not in all_created_or_updated_tool_shed_repositories: all_created_or_updated_tool_shed_repositories.append( tool_shed_repository ) # Only append the tool shed repository to the list of created_or_updated_tool_shed_repositories if it is supposed to be installed. @@ -461,10 +459,9 @@ common_util.parse_repository_dependency_tuple( repository_dependency ) if suc.tool_shed_is_this_tool_shed( toolshed ): required_repository = suc.get_repository_by_name_and_owner( trans.app, name, owner ) - required_repository_metadata = \ - metadata_util.get_repository_metadata_by_repository_id_changeset_revision( trans, - trans.security.encode_id( required_repository.id ), - changeset_revision ) + required_repository_metadata = metadata_util.get_repository_metadata_by_repository_id_changeset_revision( trans, + trans.security.encode_id( required_repository.id ), + changeset_revision ) if required_repository_metadata: # The required_repository_metadata changeset_revision is installable. required_metadata = required_repository_metadata.metadata diff -r c40ecf876d68ed86ac874f9b8c4b4d0fcb9bc69e -r 97fd1b009c86ac992716ce6e81d45cb20c06a3c1 lib/tool_shed/util/tool_util.py --- a/lib/tool_shed/util/tool_util.py +++ b/lib/tool_shed/util/tool_util.py @@ -108,7 +108,7 @@ for k, v in trans.app.toolbox.tool_panel.items(): if isinstance( v, galaxy.tools.ToolSection ): options.append( ( v.name, v.id ) ) - select_field = SelectField( name='tool_panel_section_id', display='radio' ) + select_field = SelectField( name='tool_panel_section', display='radio' ) for option_tup in options: select_field.add_option( option_tup[ 0 ], option_tup[ 1 ] ) return select_field @@ -461,28 +461,29 @@ fh.close() return sample_files, deleted_sample_files -def get_or_create_tool_section( trans, tool_panel_section_id, new_tool_panel_section_label=None ): - if tool_panel_section_id.startswith( 'section_' ): - tool_panel_section_key = tool_panel_section_id - tool_panel_section_id.lstrip( 'section_' ) - else: - tool_panel_section_key = 'section_%s' % str( tool_panel_section_id ) +def get_or_create_tool_section( trans, tool_panel_section_id, new_tool_panel_section=None ): + tool_panel_section_key = 'section_%s' % str( tool_panel_section_id ) if tool_panel_section_key in trans.app.toolbox.tool_panel: # Appending a tool to an existing section in trans.app.toolbox.tool_panel tool_section = trans.app.toolbox.tool_panel[ tool_panel_section_key ] log.debug( "Appending to tool panel section: %s" % str( tool_section.name ) ) else: # Appending a new section to trans.app.toolbox.tool_panel - if new_tool_panel_section_label is None: - # This might add an ugly section label to the tool panel, but, oh well... - new_tool_panel_section_label = tool_panel_section_id - elem = XmlET.Element( 'section' ) - elem.attrib[ 'name' ] = new_tool_panel_section_label - elem.attrib[ 'id' ] = tool_panel_section_id - elem.attrib[ 'version' ] = '' - tool_section = galaxy.tools.ToolSection( elem ) - trans.app.toolbox.tool_panel[ tool_panel_section_key ] = tool_section - log.debug( "Loading new tool panel section: %s" % str( tool_section.name ) ) + try: + new_tool_panel_section_name = new_tool_panel_section.name + except: + new_tool_panel_section_name = new_tool_panel_section + if new_tool_panel_section_name: + elem = XmlET.Element( 'section' ) + elem.attrib[ 'name' ] = new_tool_panel_section_name + elem.attrib[ 'id' ] = tool_panel_section_id + elem.attrib[ 'version' ] = '' + tool_section = galaxy.tools.ToolSection( elem ) + trans.app.toolbox.tool_panel[ tool_panel_section_key ] = tool_section + log.debug( "Loading new tool panel section: %s" % str( tool_section.name ) ) + else: + log.debug( "Unable to create new tool pane section using received new_tool_panel_section: %s" % str( new_tool_panel_section )) + return None, None return tool_panel_section_key, tool_section def get_tool_path_install_dir( partial_install_dir, shed_tool_conf_dict, tool_dict, config_elems ): @@ -632,20 +633,16 @@ error = True return error, message -def handle_tool_panel_selection( trans, metadata, no_changes_checked, tool_panel_section_id, new_tool_panel_section_label ): - """ - Handle the selected tool panel location for loading tools included in tool shed repositories when installing - or reinstalling them. - """ +def handle_tool_panel_selection( trans, metadata, no_changes_checked, tool_panel_section, new_tool_panel_section ): + """Handle the selected tool panel location for loading tools included in tool shed repositories when installing or reinstalling them.""" # Get the location in the tool panel in which each tool was originally loaded. tool_section = None tool_panel_section_key = None if 'tools' in metadata: # This forces everything to be loaded into the same section (or no section) in the tool panel. if no_changes_checked: - # Make sure the no_changes check box overrides the new_tool_panel_section_label if the user checked the check - # box and entered something into the field. - new_tool_panel_section_label = None + # Make sure the no_changes check box overrides the new_tool_panel_section if the user checked the check box and entered something into the field. + new_tool_panel_section = None if 'tool_panel_section' in metadata: tool_panel_dict = metadata[ 'tool_panel_section' ] if not tool_panel_dict: @@ -659,33 +656,24 @@ original_section_id = tool_section_dict[ 'id' ] original_section_name = tool_section_dict[ 'name' ] if original_section_id: - tool_panel_section_key, tool_section = \ - get_or_create_tool_section( trans, - tool_panel_section_id=original_section_id, - new_tool_panel_section_label=new_tool_panel_section_label ) + tool_panel_section_key, tool_section = get_or_create_tool_section( trans, + tool_panel_section_id=original_section_id, + new_tool_panel_section=new_tool_panel_section ) else: # The user elected to change the tool panel section to contain the tools. tool_panel_section_key, tool_section = handle_tool_panel_section( trans, - tool_panel_section_id=tool_panel_section_id, - new_tool_panel_section_label=new_tool_panel_section_label ) - return tool_section, tool_panel_section_key + tool_panel_section=tool_panel_section, + new_tool_panel_section=new_tool_panel_section ) + return tool_section, new_tool_panel_section, tool_panel_section_key -def handle_tool_panel_section( trans, tool_panel_section_id=None, new_tool_panel_section_label=None ): - """Return a ToolSection object retrieved from the current in-memory tool_panel.""" - # If tool_panel_section_id is received, the section exists in the tool panel. In this case, the value of the - # received tool_panel_section_id must be the id retrieved from a tool panel config (e.g., tool_conf.xml, which - # may have getext). If new_tool_panel_section_label is received, a new section will be added to the tool panel. - if new_tool_panel_section_label: - section_id = 'section_%s' % str( new_tool_panel_section_label.lower().replace( ' ', '_' ) ) - tool_panel_section_key, tool_section = \ - get_or_create_tool_section( trans, - tool_panel_section_id=section_id, - new_tool_panel_section_label=new_tool_panel_section_label ) - elif tool_panel_section_id: - if tool_panel_section_id.startswith( 'section_' ): - tool_panel_section_key = str( tool_panel_section_id ) - else: - tool_panel_section_key = 'section_%s' % str( tool_panel_section_id ) +def handle_tool_panel_section( trans, tool_panel_section=None, new_tool_panel_section=None ): + if new_tool_panel_section: + section_id = new_tool_panel_section.lower().replace( ' ', '_' ) + tool_panel_section_key, tool_section = get_or_create_tool_section( trans, + tool_panel_section_id=section_id, + new_tool_panel_section=new_tool_panel_section ) + elif tool_panel_section: + tool_panel_section_key = 'section_%s' % str( tool_panel_section ) tool_section = trans.app.toolbox.tool_panel[ tool_panel_section_key ] else: return None, None https://bitbucket.org/galaxy/galaxy-central/commits/0b165ce6fac7/ Changeset: 0b165ce6fac7 User: natefoo Date: 2014-01-14 17:40:40 Summary: Merge backout from stable. Affected #: 4 files 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.