1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/a5dd3ca6f5ef/ Changeset: a5dd3ca6f5ef User: greg Date: 2013-06-20 20:55:23 Summary: Fix for allowing the Galaxy admin to select a tool panel section when installing a repository that contains no tools but has repository dependencies that contain tools. Affected #: 3 files diff -r 89e7db1cd8098fd6191ab3b4af92e4af32e4c651 -r a5dd3ca6f5ef97eadf62bc4642c8d36c4ed3bce4 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 @@ -857,11 +857,17 @@ 'repository/get_repository_information?repository_ids=%s&changeset_revisions=%s' % \ ( repository_ids, changeset_revisions ) ) raw_text = common_util.tool_shed_get( trans.app, tool_shed_url, url ) - repo_information_dict = json.from_json_string( raw_text ) - includes_tools = util.string_as_bool( repo_information_dict.get( 'includes_tools', False ) ) - includes_tools_for_display_in_tool_panel = util.string_as_bool( repo_information_dict.get( 'includes_tools_for_display_in_tool_panel', False ) ) - has_repository_dependencies = util.string_as_bool( repo_information_dict.get( 'has_repository_dependencies', False ) ) - includes_tool_dependencies = util.string_as_bool( repo_information_dict.get( 'includes_tool_dependencies', False ) ) + repo_information_dict = json.from_json_string( raw_text ) + for encoded_repo_info_dict in repo_information_dict.get( 'repo_info_dicts', [] ): + decoded_repo_info_dict = encoding_util.tool_shed_decode( encoded_repo_info_dict ) + if not includes_tools: + includes_tools = util.string_as_bool( decoded_repo_info_dict.get( 'includes_tools', False ) ) + if not includes_tools_for_display_in_tool_panel: + includes_tools_for_display_in_tool_panel = util.string_as_bool( decoded_repo_info_dict.get( 'includes_tools_for_display_in_tool_panel', False ) ) + if not has_repository_dependencies: + has_repository_dependencies = util.string_as_bool( repo_information_dict.get( 'has_repository_dependencies', False ) ) + if not includes_tool_dependencies: + includes_tool_dependencies = util.string_as_bool( repo_information_dict.get( 'includes_tool_dependencies', False ) ) encoded_repo_info_dicts = util.listify( repo_information_dict.get( 'repo_info_dicts', [] ) ) repo_info_dicts = [ encoding_util.tool_shed_decode( encoded_repo_info_dict ) for encoded_repo_info_dict in encoded_repo_info_dicts ] if ( not includes_tools_for_display_in_tool_panel and kwd.get( 'select_shed_tool_panel_config_button', False ) ) or \ @@ -925,9 +931,25 @@ if len( repo_info_dicts ) == 1: # If we're installing a single repository, see if it contains a readme or dependencies that we can display. repo_info_dict = repo_info_dicts[ 0 ] - name, repository_owner, changeset_revision, includes_tool_dependencies, installed_repository_dependencies, \ - missing_repository_dependencies, installed_tool_dependencies, missing_tool_dependencies = \ - common_install_util.get_dependencies_for_repository( trans, tool_shed_url, repo_info_dict, includes_tool_dependencies ) + dependencies_for_repository_dict = common_install_util.get_dependencies_for_repository( trans, + tool_shed_url, + repo_info_dict, + includes_tool_dependencies ) + changeset_revision = dependencies_for_repository_dict.get( 'changeset_revision', None ) + if not has_repository_dependencies: + has_repository_dependencies = dependencies_for_repository_dict.get( 'has_repository_dependencies', False ) + if not includes_tool_dependencies: + includes_tool_dependencies = dependencies_for_repository_dict.get( 'includes_tool_dependencies', False ) + if not includes_tools: + includes_tools = dependencies_for_repository_dict.get( 'includes_tools', False ) + if not includes_tools_for_display_in_tool_panel: + includes_tools_for_display_in_tool_panel = dependencies_for_repository_dict.get( 'includes_tools_for_display_in_tool_panel', False ) + installed_repository_dependencies = dependencies_for_repository_dict.get( 'installed_repository_dependencies', None ) + installed_tool_dependencies = dependencies_for_repository_dict.get( 'installed_tool_dependencies', None ) + missing_repository_dependencies = dependencies_for_repository_dict.get( 'missing_repository_dependencies', None ) + missing_tool_dependencies = dependencies_for_repository_dict.get( 'missing_tool_dependencies', None ) + name = dependencies_for_repository_dict.get( 'name', None ) + repository_owner = dependencies_for_repository_dict.get( 'repository_owner', None ) readme_files_dict = readme_util.get_readme_files_dict_for_display( trans, tool_shed_url, repo_info_dict ) # We're handling 1 of 2 scenarios here: (1) we're installing a tool shed repository for the first time, so we've retrieved the list of installed # and missing repository dependencies from the database (2) we're handling the scenario where an error occurred during the installation process, @@ -946,9 +968,25 @@ # We're installing a list of repositories, each of which may have tool dependencies or repository dependencies. containers_dicts = [] for repo_info_dict in repo_info_dicts: - name, repository_owner, changeset_revision, includes_tool_dependencies, installed_repository_dependencies, \ - missing_repository_dependencies, installed_tool_dependencies, missing_tool_dependencies = \ - common_install_util.get_dependencies_for_repository( trans, tool_shed_url, repo_info_dict, includes_tool_dependencies ) + dependencies_for_repository_dict = common_install_util.get_dependencies_for_repository( trans, + tool_shed_url, + repo_info_dict, + includes_tool_dependencies ) + changeset_revision = dependencies_for_repository_dict.get( 'changeset_revision', None ) + if not has_repository_dependencies: + has_repository_dependencies = dependencies_for_repository_dict.get( 'has_repository_dependencies', False ) + if not includes_tool_dependencies: + includes_tool_dependencies = dependencies_for_repository_dict.get( 'includes_tool_dependencies', False ) + if not includes_tools: + includes_tools = dependencies_for_repository_dict.get( 'includes_tools', False ) + if not includes_tools_for_display_in_tool_panel: + includes_tools_for_display_in_tool_panel = dependencies_for_repository_dict.get( 'includes_tools_for_display_in_tool_panel', False ) + installed_repository_dependencies = dependencies_for_repository_dict.get( 'installed_repository_dependencies', None ) + installed_tool_dependencies = dependencies_for_repository_dict.get( 'installed_tool_dependencies', None ) + missing_repository_dependencies = dependencies_for_repository_dict.get( 'missing_repository_dependencies', None ) + missing_tool_dependencies = dependencies_for_repository_dict.get( 'missing_tool_dependencies', None ) + name = dependencies_for_repository_dict.get( 'name', None ) + repository_owner = dependencies_for_repository_dict.get( 'repository_owner', None ) containers_dict = repository_util.populate_containers_dict_for_new_install( trans=trans, tool_shed_url=tool_shed_url, tool_path=tool_path, @@ -1241,9 +1279,22 @@ repository_metadata=None, tool_dependencies=tool_dependencies, repository_dependencies=repository_dependencies ) - repository_name, repository_owner, changeset_revision, includes_tool_dependencies, installed_repository_dependencies, \ - missing_repository_dependencies, installed_tool_dependencies, missing_tool_dependencies = \ - common_install_util.get_dependencies_for_repository( trans, tool_shed_url, repo_info_dict, includes_tool_dependencies ) + dependencies_for_repository_dict = common_install_util.get_dependencies_for_repository( trans, + tool_shed_url, + repo_info_dict, + includes_tool_dependencies ) + changeset_revision = dependencies_for_repository_dict.get( 'changeset_revision', None ) + has_repository_dependencies = dependencies_for_repository_dict.get( 'has_repository_dependencies', False ) + includes_tool_dependencies = dependencies_for_repository_dict.get( 'includes_tool_dependencies', False ) + includes_tools = dependencies_for_repository_dict.get( 'includes_tools', False ) + includes_tools_for_display_in_tool_panel = dependencies_for_repository_dict.get( 'includes_tools_for_display_in_tool_panel', False ) + installed_repository_dependencies = dependencies_for_repository_dict.get( 'installed_repository_dependencies', None ) + installed_tool_dependencies = dependencies_for_repository_dict.get( 'installed_tool_dependencies', None ) + missing_repository_dependencies = dependencies_for_repository_dict.get( 'missing_repository_dependencies', None ) + missing_tool_dependencies = dependencies_for_repository_dict.get( 'missing_tool_dependencies', None ) + repository_name = dependencies_for_repository_dict.get( 'name', None ) + repository_owner = dependencies_for_repository_dict.get( 'repository_owner', None ) + if installed_repository_dependencies or missing_repository_dependencies: has_repository_dependencies = True else: diff -r 89e7db1cd8098fd6191ab3b4af92e4af32e4c651 -r a5dd3ca6f5ef97eadf62bc4642c8d36c4ed3bce4 lib/tool_shed/util/common_install_util.py --- a/lib/tool_shed/util/common_install_util.py +++ b/lib/tool_shed/util/common_install_util.py @@ -83,7 +83,12 @@ else: installed_rd, missing_rd = get_installed_and_missing_repository_dependencies_for_new_install( trans, repo_info_tuple ) # Discover all repository dependencies and retrieve information for installing them. - required_repo_info_dicts = get_required_repo_info_dicts( trans, tool_shed_url, util.listify( repo_info_dict ) ) + all_repo_info_dict = get_required_repo_info_dicts( trans, tool_shed_url, util.listify( repo_info_dict ) ) + has_repository_dependencies = all_repo_info_dict.get( 'has_repository_dependencies', False ) + includes_tools_for_display_in_tool_panel = all_repo_info_dict.get( 'includes_tools_for_display_in_tool_panel', False ) + includes_tool_dependencies = all_repo_info_dict.get( 'includes_tool_dependencies', False ) + includes_tools = all_repo_info_dict.get( 'includes_tools', False ) + required_repo_info_dicts = all_repo_info_dict.get( 'all_repo_info_dicts', [] ) # Display tool dependencies defined for each of the repository dependencies. if required_repo_info_dicts: all_tool_dependencies = {} @@ -120,10 +125,24 @@ if td_key not in missing_td: missing_td[ td_key ] = td_dict else: + has_repository_dependencies = False + includes_tools = False + includes_tools_for_display_in_tool_panel = False installed_rd = None missing_rd = None missing_td = None - return name, repository_owner, changeset_revision, includes_tool_dependencies, installed_rd, missing_rd, installed_td, missing_td + dependencies_for_repository_dict = dict( changeset_revision=changeset_revision, + has_repository_dependencies=has_repository_dependencies, + includes_tool_dependencies=includes_tool_dependencies, + includes_tools=includes_tools, + includes_tools_for_display_in_tool_panel=includes_tools_for_display_in_tool_panel, + installed_repository_dependencies=installed_rd, + installed_tool_dependencies=installed_td, + missing_repository_dependencies=missing_rd, + missing_tool_dependencies=missing_td, + name=name, + repository_owner=repository_owner ) + return dependencies_for_repository_dict def get_installed_and_missing_repository_dependencies( trans, repository ): """ @@ -247,6 +266,7 @@ repository_dependencies entries in each of the received repo_info_dicts includes all required repositories, so only one pass through this method is required to retrieve all repository dependencies. """ + all_required_repo_info_dict = {} all_repo_info_dicts = [] if repo_info_dicts: # We'll send tuples of ( tool_shed, repository_name, repository_owner, changeset_revision ) to the tool shed to discover repository ids. @@ -292,15 +312,24 @@ log.exception( e ) return all_repo_info_dicts required_repo_info_dicts = [] - encoded_dict_strings = required_repo_info_dict[ 'repo_info_dicts' ] - for encoded_dict_str in encoded_dict_strings: - decoded_dict = encoding_util.tool_shed_decode( encoded_dict_str ) - required_repo_info_dicts.append( decoded_dict ) - if required_repo_info_dicts: - for required_repo_info_dict in required_repo_info_dicts: - if required_repo_info_dict not in all_repo_info_dicts: - all_repo_info_dicts.append( required_repo_info_dict ) - return all_repo_info_dicts + for k, v in required_repo_info_dict.items(): + if k == 'repo_info_dicts': + encoded_dict_strings = required_repo_info_dict[ 'repo_info_dicts' ] + for encoded_dict_str in encoded_dict_strings: + decoded_dict = encoding_util.tool_shed_decode( encoded_dict_str ) + required_repo_info_dicts.append( decoded_dict ) + else: + if k not in all_required_repo_info_dict: + all_required_repo_info_dict[ k ] = v + else: + if v and not all_required_repo_info_dict[ k ]: + all_required_repo_info_dict[ k ] = v + if required_repo_info_dicts: + for required_repo_info_dict in required_repo_info_dicts: + if required_repo_info_dict not in all_repo_info_dicts: + all_repo_info_dicts.append( required_repo_info_dict ) + all_required_repo_info_dict[ 'all_repo_info_dicts' ] = all_repo_info_dicts + return all_required_repo_info_dict def handle_tool_dependencies( app, tool_shed_repository, tool_dependencies_config, tool_dependencies ): """ diff -r 89e7db1cd8098fd6191ab3b4af92e4af32e4c651 -r a5dd3ca6f5ef97eadf62bc4642c8d36c4ed3bce4 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 @@ -115,7 +115,8 @@ filtered_repo_info_dicts = [] # Discover all repository dependencies and retrieve information for installing them. Even if the user elected to not install repository dependencies we have # to make sure all repository dependency objects exist so that the appropriate repository dependency relationships can be built. - all_repo_info_dicts = common_install_util.get_required_repo_info_dicts( trans, tool_shed_url, repo_info_dicts ) + all_required_repo_info_dict = common_install_util.get_required_repo_info_dicts( trans, tool_shed_url, repo_info_dicts ) + all_repo_info_dicts = all_required_repo_info_dict.get( 'all_repo_info_dicts', [] ) if not all_repo_info_dicts: # No repository dependencies were discovered so process the received repositories. all_repo_info_dicts = [ rid for rid in repo_info_dicts ] 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.