1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/d95be6981cc9/ Changeset: d95be6981cc9 User: greg Date: 2013-07-18 16:51:23 Summary: Enhance messaging in the tool shed as a result of the introduction of support for repository types. Affected #: 7 files diff -r 3985ecec291f3b1a52997f0ad4fb6579045f16c2 -r d95be6981cc9a862a458bebb218a5180319ecbd7 lib/galaxy/webapps/tool_shed/controllers/repository.py --- a/lib/galaxy/webapps/tool_shed/controllers/repository.py +++ b/lib/galaxy/webapps/tool_shed/controllers/repository.py @@ -2174,11 +2174,12 @@ key_rd_dicts_to_be_processed=None, all_repository_dependencies=None, handled_key_rd_dicts=None ) - # Handle messaging for orphan tool dependencies. - orphan_message = tool_dependency_util.generate_message_for_orphan_tool_dependencies( metadata ) - if orphan_message: - message += orphan_message - status = 'warning' + if str( repository.type ) != rt_util.TOOL_DEPENDENCY_DEFINITION: + # Handle messaging for orphan tool dependencies. + orphan_message = tool_dependency_util.generate_message_for_orphan_tool_dependencies( trans, repository, metadata ) + if orphan_message: + message += orphan_message + status = 'warning' if is_malicious: if trans.app.security_agent.can_push( trans.app, trans.user, repository ): message += malicious_error_can_push @@ -2976,11 +2977,6 @@ key_rd_dicts_to_be_processed=None, all_repository_dependencies=None, handled_key_rd_dicts=None ) - # Handle messaging for orphan tool dependencies. - orphan_message = tool_dependency_util.generate_message_for_orphan_tool_dependencies( metadata ) - if orphan_message: - message += orphan_message - status = 'warning' else: metadata = None is_malicious = suc.changeset_is_malicious( trans, id, repository.tip( trans.app ) ) diff -r 3985ecec291f3b1a52997f0ad4fb6579045f16c2 -r d95be6981cc9a862a458bebb218a5180319ecbd7 lib/galaxy/webapps/tool_shed/controllers/upload.py --- a/lib/galaxy/webapps/tool_shed/controllers/upload.py +++ b/lib/galaxy/webapps/tool_shed/controllers/upload.py @@ -206,15 +206,16 @@ metadata_dict = repository.metadata_revisions[0].metadata else: metadata_dict = {} - # Provide a warning message if a tool_dependencies.xml file is provided, but tool dependencies weren't loaded due to a requirement tag mismatch - # or some other problem. Tool dependency definitions can define orphan tool dependencies (no relationship to any tools contained in the repository), - # so warning messages are important because orphans are always valid. The repository owner must be warned in case they did not intend to define an - # orphan dependency, but simply provided incorrect information (tool shed, name owner, changeset_revision) for the definition. - # Handle messaging for orphan tool dependencies. - orphan_message = tool_dependency_util.generate_message_for_orphan_tool_dependencies( metadata_dict ) - if orphan_message: - message += orphan_message - status = 'warning' + if str( repository.type ) != rt_util.TOOL_DEPENDENCY_DEFINITION: + # Provide a warning message if a tool_dependencies.xml file is provided, but tool dependencies weren't loaded due to a requirement tag mismatch + # or some other problem. Tool dependency definitions can define orphan tool dependencies (no relationship to any tools contained in the repository), + # so warning messages are important because orphans are always valid. The repository owner must be warned in case they did not intend to define an + # orphan dependency, but simply provided incorrect information (tool shed, name owner, changeset_revision) for the definition. + # Handle messaging for orphan tool dependencies. + orphan_message = tool_dependency_util.generate_message_for_orphan_tool_dependencies( trans, repository, metadata_dict ) + if orphan_message: + message += orphan_message + status = 'warning' # Handle messaging for invalid tool dependencies. invalid_tool_dependencies_message = tool_dependency_util.generate_message_for_invalid_tool_dependencies( metadata_dict ) if invalid_tool_dependencies_message: diff -r 3985ecec291f3b1a52997f0ad4fb6579045f16c2 -r d95be6981cc9a862a458bebb218a5180319ecbd7 lib/galaxy/webapps/tool_shed/model/__init__.py --- a/lib/galaxy/webapps/tool_shed/model/__init__.py +++ b/lib/galaxy/webapps/tool_shed/model/__init__.py @@ -171,7 +171,7 @@ def can_change_type_to( self, app, new_type_label ): if self.can_change_type( app ): new_type = app.repository_types_registry.get_class_by_label( new_type_label ) - if new_type.is_valid_for_type( self ): + if new_type.is_valid_for_type( app, self ): return True return False diff -r 3985ecec291f3b1a52997f0ad4fb6579045f16c2 -r d95be6981cc9a862a458bebb218a5180319ecbd7 lib/tool_shed/repository_types/metadata.py --- a/lib/tool_shed/repository_types/metadata.py +++ b/lib/tool_shed/repository_types/metadata.py @@ -18,7 +18,7 @@ repo = hg.repository( ui.ui(), repository.repo_path( app ) ) return repo.changelog - def is_valid_for_type( self, repository, revisions_to_check=None ): + def is_valid_for_type( self, app, repository, revisions_to_check=None ): raise "Unimplemented Method" diff -r 3985ecec291f3b1a52997f0ad4fb6579045f16c2 -r d95be6981cc9a862a458bebb218a5180319ecbd7 lib/tool_shed/util/tool_dependency_util.py --- a/lib/tool_shed/util/tool_dependency_util.py +++ b/lib/tool_shed/util/tool_dependency_util.py @@ -5,6 +5,7 @@ from galaxy import util from galaxy.model.orm import and_ import tool_shed.util.shed_util_common as suc +import tool_shed.repository_types.util as rt_util from tool_shed.util import xml_util log = logging.getLogger( __name__ ) @@ -115,7 +116,7 @@ message = '%s ' % str( error ) return message -def generate_message_for_orphan_tool_dependencies( metadata_dict ): +def generate_message_for_orphan_tool_dependencies( trans, repository, metadata_dict ): """ The introduction of the support for orphan tool dependency definitions in tool shed repositories has resulted in the inability to define an improperly configured tool dependency definition / tool config requirements tag combination as an invalid tool @@ -127,28 +128,34 @@ if metadata_dict: orphan_tool_dependencies = metadata_dict.get( 'orphan_tool_dependencies', None ) if orphan_tool_dependencies: - if 'tools' not in metadata_dict and 'invalid_tools' not in metadata_dict: + if 'tools' in metadata_dict or 'invalid_tools' in metadata_dict: + for td_key, requirements_dict in orphan_tool_dependencies.items(): + if td_key == 'set_environment': + # "set_environment": [{"name": "R_SCRIPT_PATH", "type": "set_environment"}] + message += "The settings for <b>name</b> and <b>type</b> from a contained tool configuration file's <b>requirement</b> tag " + message += "does not match the information for the following tool dependency definitions in the <b>tool_dependencies.xml</b> " + message += "file, so these tool dependencies have no relationship with any tools within this repository.<br/>" + for env_requirements_dict in requirements_dict: + name = env_requirements_dict[ 'name' ] + type = env_requirements_dict[ 'type' ] + message += "<b>* name:</b> %s, <b>type:</b> %s<br/>" % ( str( name ), str( type ) ) + else: + # "R/2.15.1": {"name": "R", "readme": "some string", "type": "package", "version": "2.15.1"} + message += "The settings for <b>name</b>, <b>version</b> and <b>type</b> from a contained tool configuration file's " + message += "<b>requirement</b> tag does not match the information for the following tool dependency definitions in the " + message += "<b>tool_dependencies.xml</b> file, so these tool dependencies have no relationship with any tools within " + message += "this repository.<br/>" + name = requirements_dict[ 'name' ] + type = requirements_dict[ 'type' ] + version = requirements_dict[ 'version' ] + message += "<b>* name:</b> %s, <b>type:</b> %s, <b>version:</b> %s<br/>" % ( str( name ), str( type ), str( version ) ) + message += "<br/>" + elif repository.can_change_type_to( trans.app, rt_util.TOOL_DEPENDENCY_DEFINITION ): + tool_dependency_definition_type_class = trans.app.repository_types_registry.get_class_by_label( rt_util.TOOL_DEPENDENCY_DEFINITION ) + message += "This repository currently contains a single file named <b>%s</b>. If additional files will " % suc.TOOL_DEPENDENCY_DEFINITION_FILENAME + message += "not be added to this repository, then it's type should be set to <b>%s</b>.<br/>" % tool_dependency_definition_type_class.label + else: message += "This repository contains no tools, so these tool dependencies are considered orphans within this repository.<br/>" - for td_key, requirements_dict in orphan_tool_dependencies.items(): - if td_key == 'set_environment': - # "set_environment": [{"name": "R_SCRIPT_PATH", "type": "set_environment"}] - message += "The settings for <b>name</b> and <b>type</b> from a contained tool configuration file's <b>requirement</b> tag " - message += "does not match the information for the following tool dependency definitions in the <b>tool_dependencies.xml</b> " - message += "file, so these tool dependencies are considered orphans within this repository.<br/>" - for env_requirements_dict in requirements_dict: - name = env_requirements_dict[ 'name' ] - type = env_requirements_dict[ 'type' ] - message += "<b>* name:</b> %s, <b>type:</b> %s<br/>" % ( str( name ), str( type ) ) - else: - # "R/2.15.1": {"name": "R", "readme": "some string", "type": "package", "version": "2.15.1"} - message += "The settings for <b>name</b>, <b>version</b> and <b>type</b> from a contained tool configuration file's " - message += "<b>requirement</b> tag does not match the information for the following tool dependency definitions in the " - message += "<b>tool_dependencies.xml</b> file, so these tool dependencies are considered orphans within this repository.<br/>" - name = requirements_dict[ 'name' ] - type = requirements_dict[ 'type' ] - version = requirements_dict[ 'version' ] - message += "<b>* name:</b> %s, <b>type:</b> %s, <b>version:</b> %s<br/>" % ( str( name ), str( type ), str( version ) ) - message += "<br/>" return message def get_installed_and_missing_tool_dependencies( trans, repository, all_tool_dependencies ): diff -r 3985ecec291f3b1a52997f0ad4fb6579045f16c2 -r d95be6981cc9a862a458bebb218a5180319ecbd7 test/tool_shed/functional/test_0100_complex_repository_dependencies.py --- a/test/tool_shed/functional/test_0100_complex_repository_dependencies.py +++ b/test/tool_shed/functional/test_0100_complex_repository_dependencies.py @@ -51,7 +51,7 @@ uncompress_file=False, remove_repo_files_not_in_tar=False, commit_message='Uploaded tool_dependencies.xml.', - strings_displayed=[ 'The settings for <b>name</b>, <b>version</b> and <b>type</b> from a contained tool' ], + strings_displayed=[ 'This repository currently contains a single file named <b>tool_dependencies.xml</b>' ], strings_not_displayed=[] ) # Visit the manage repository page for package_bwa_0_5_9_0100. self.display_manage_repository_page( repository, strings_displayed=[ 'Tool dependencies', 'may not be', 'in this repository' ] ) diff -r 3985ecec291f3b1a52997f0ad4fb6579045f16c2 -r d95be6981cc9a862a458bebb218a5180319ecbd7 test/tool_shed/functional/test_0170_complex_prior_installation_required.py --- a/test/tool_shed/functional/test_0170_complex_prior_installation_required.py +++ b/test/tool_shed/functional/test_0170_complex_prior_installation_required.py @@ -56,7 +56,7 @@ uncompress_file=True, remove_repo_files_not_in_tar=False, commit_message='Uploaded matplotlib tool dependency tarball.', - strings_displayed=['orphan'], + strings_displayed=[ 'This repository currently contains a single file named <b>tool_dependencies.xml</b>' ], strings_not_displayed=[] ) def test_0010_create_numpy_repository( self ): @@ -80,7 +80,7 @@ uncompress_file=True, remove_repo_files_not_in_tar=False, commit_message='Uploaded numpy tool dependency tarball.', - strings_displayed=['orphan'], + strings_displayed=[ 'This repository currently contains a single file named <b>tool_dependencies.xml</b>' ], strings_not_displayed=[] ) def test_0015_create_complex_repository_dependency( self ): 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.