1 new commit in galaxy-central:
https://bitbucket.org/galaxy/galaxy-central/commits/d0979f737213/ Changeset: d0979f737213 User: greg Date: 2014-05-21 15:55:12 Summary: Change function signatures for several utility functions that used to require trans but now only need app. Affected #: 13 files
diff -r e3c0070b64bae25215e9a30822f6e7488e938969 -r d0979f737213cbc8e000a46f90a7cd5501c709d1 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 @@ -1,6 +1,7 @@ import logging import os import shutil + from admin import AdminGalaxy from galaxy import eggs from galaxy import web @@ -10,7 +11,10 @@ from galaxy.web.framework.helpers import iff from galaxy.util import json from galaxy.model.orm import or_ + import tool_shed.util.shed_util_common as suc +import tool_shed.repository_types.util as rt_util + from tool_shed.util import common_util from tool_shed.util import common_install_util from tool_shed.util import data_manager_util @@ -26,6 +30,7 @@ from tool_shed.util import xml_util from tool_shed.galaxy_install import repository_util import tool_shed.galaxy_install.grids.admin_toolshed_grids as admin_toolshed_grids + import pkg_resources
eggs.require( 'mercurial' ) @@ -458,7 +463,7 @@ err_msg = '' tool_shed_repository = tool_dependencies[ 0 ].tool_shed_repository # Get the tool_dependencies.xml file from the repository. - tool_dependencies_config = suc.get_config_from_disk( suc.TOOL_DEPENDENCY_DEFINITION_FILENAME, + tool_dependencies_config = suc.get_config_from_disk( rt_util.TOOL_DEPENDENCY_DEFINITION_FILENAME, tool_shed_repository.repo_path( trans.app ) ) installed_tool_dependencies = \ common_install_util.install_specified_packages( app=trans.app,
diff -r e3c0070b64bae25215e9a30822f6e7488e938969 -r d0979f737213cbc8e000a46f90a7cd5501c709d1 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 @@ -1713,11 +1713,14 @@ changeset_revision = kwd.get( 'changeset_revision', None ) repository = suc.get_repository_by_name_and_owner( trans.app, name, owner ) repository_id = trans.security.encode_id( repository.id ) - # We aren't concerned with repositories of type tool_dependency_definition here if a repository_metadata record is not returned - # because repositories of this type will never have repository dependencies. However, if a readme file is uploaded, or some other - # change is made that does not create a new downloadable changeset revision but updates the existing one, we still want to be able - # to get repository dependencies. - repository_metadata = suc.get_current_repository_metadata_for_changeset_revision( trans, repository, changeset_revision ) + # We aren't concerned with repositories of type tool_dependency_definition here if a + # repository_metadata record is not returned because repositories of this type will never + # have repository dependencies. However, if a readme file is uploaded, or some other change + # is made that does not create a new downloadable changeset revision but updates the existing + # one, we still want to be able to get repository dependencies. + repository_metadata = suc.get_current_repository_metadata_for_changeset_revision( trans.app, + repository, + changeset_revision ) if repository_metadata: metadata = repository_metadata.metadata if metadata: @@ -1838,7 +1841,7 @@ #manafest. repo_dir = repository.repo_path( trans.app ) # Get the tool_dependencies.xml file from disk. - tool_dependencies_config = suc.get_config_from_disk( suc.TOOL_DEPENDENCY_DEFINITION_FILENAME, repo_dir ) + tool_dependencies_config = suc.get_config_from_disk( rt_util.TOOL_DEPENDENCY_DEFINITION_FILENAME, repo_dir ) # Return the encoded contents of the tool_dependencies.xml file. if tool_dependencies_config: tool_dependencies_config_file = open( tool_dependencies_config, 'rb' ) @@ -2362,13 +2365,15 @@ handled_key_rd_dicts=None ) if str( repository.type ) != rt_util.REPOSITORY_SUITE_DEFINITION: # Handle messaging for resetting repository type to the optimal value. - change_repository_type_message = suc.generate_message_for_repository_type_change( trans, repository ) + change_repository_type_message = rt_util.generate_message_for_repository_type_change( trans.app, + repository ) if change_repository_type_message: message += change_repository_type_message status = 'warning' elif str( repository.type ) != rt_util.TOOL_DEPENDENCY_DEFINITION: # Handle messaging for resetting repository type to the optimal value. - change_repository_type_message = suc.generate_message_for_repository_type_change( trans, repository ) + change_repository_type_message = rt_util.generate_message_for_repository_type_change( trans.app, + repository ) if change_repository_type_message: message += change_repository_type_message status = 'warning' @@ -3245,7 +3250,7 @@ status = 'warning' else: metadata = None - is_malicious = suc.changeset_is_malicious( trans, id, repository.tip( trans.app ) ) + is_malicious = suc.changeset_is_malicious( trans.app, id, repository.tip( trans.app ) ) if is_malicious: if trans.app.security_agent.can_push( trans.app, trans.user, repository ): message += malicious_error_can_push
diff -r e3c0070b64bae25215e9a30822f6e7488e938969 -r d0979f737213cbc8e000a46f90a7cd5501c709d1 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 @@ -149,12 +149,12 @@ isgzip=isgzip, isbz2=isbz2 ) if repository.type == rt_util.REPOSITORY_SUITE_DEFINITION and \ - uploaded_file_filename != suc.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME: + uploaded_file_filename != rt_util.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME: ok = False message = 'Repositories of type <b>Repository suite definition</b> can only contain a single file named ' message += '<b>repository_dependencies.xml</b>.' elif repository.type == rt_util.TOOL_DEPENDENCY_DEFINITION and \ - uploaded_file_filename != suc.TOOL_DEPENDENCY_DEFINITION_FILENAME: + uploaded_file_filename != rt_util.TOOL_DEPENDENCY_DEFINITION_FILENAME: ok = False message = 'Repositories of type <b>Tool dependency definition</b> can only contain a single file named ' message += '<b>tool_dependencies.xml</b>.' @@ -164,7 +164,7 @@ else: full_path = os.path.abspath( os.path.join( repo_dir, uploaded_file_filename ) ) # Move some version of the uploaded file to the load_point within the repository hierarchy. - if uploaded_file_filename in [ suc.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME ]: + if uploaded_file_filename in [ rt_util.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME ]: # Inspect the contents of the file to see if changeset_revision values are missing and if so, # set them appropriately. altered, root_elem, error_message = \ @@ -180,8 +180,8 @@ shutil.move( tmp_filename, full_path ) else: shutil.move( uploaded_file_name, full_path ) - elif uploaded_file_filename in [ suc.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME, - suc.TOOL_DEPENDENCY_DEFINITION_FILENAME ]: + elif uploaded_file_filename in [ rt_util.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME, + rt_util.TOOL_DEPENDENCY_DEFINITION_FILENAME ]: # Inspect the contents of the file to see if changeset_revision values are # missing and if so, set them appropriately. altered, root_elem, error_message = \ @@ -264,7 +264,8 @@ metadata_dict = {} if str( repository.type ) not in [ rt_util.REPOSITORY_SUITE_DEFINITION, rt_util.TOOL_DEPENDENCY_DEFINITION ]: - change_repository_type_message = suc.generate_message_for_repository_type_change( trans, repository ) + change_repository_type_message = rt_util.generate_message_for_repository_type_change( trans.app, + repository ) if change_repository_type_message: message += change_repository_type_message status = 'warning' @@ -336,9 +337,9 @@ for uploaded_file in files: relative_path = os.path.normpath( os.path.join( os.path.relpath( root, uploaded_directory ), uploaded_file ) ) if repository.type == rt_util.REPOSITORY_SUITE_DEFINITION: - ok = os.path.basename( uploaded_file ) == suc.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME + ok = os.path.basename( uploaded_file ) == rt_util.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME elif repository.type == rt_util.TOOL_DEPENDENCY_DEFINITION: - ok = os.path.basename( uploaded_file ) == suc.TOOL_DEPENDENCY_DEFINITION_FILENAME + ok = os.path.basename( uploaded_file ) == rt_util.TOOL_DEPENDENCY_DEFINITION_FILENAME else: ok = os.path.basename( uploaded_file ) not in commit_util.UNDESIRABLE_FILES if ok: @@ -351,7 +352,7 @@ undesirable_files_removed += 1 if ok: uploaded_file_name = os.path.abspath( os.path.join( root, uploaded_file ) ) - if os.path.split( uploaded_file_name )[ -1 ] == suc.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME: + if os.path.split( uploaded_file_name )[ -1 ] == rt_util.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME: # Inspect the contents of the file to see if changeset_revision values are missing and # if so, set them appropriately. altered, root_elem, error_message = \ @@ -363,7 +364,7 @@ elif altered: tmp_filename = xml_util.create_and_write_tmp_file( root_elem ) shutil.move( tmp_filename, uploaded_file_name ) - elif os.path.split( uploaded_file_name )[ -1 ] == suc.TOOL_DEPENDENCY_DEFINITION_FILENAME: + elif os.path.split( uploaded_file_name )[ -1 ] == rt_util.TOOL_DEPENDENCY_DEFINITION_FILENAME: # Inspect the contents of the file to see if changeset_revision values are missing and if so, set them appropriately. altered, root_elem, error_message = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name ) if error_message: @@ -420,7 +421,7 @@ uploaded_file.close() for filename in filenames_in_archive: uploaded_file_name = os.path.join( full_path, filename ) - if os.path.split( uploaded_file_name )[ -1 ] == suc.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME: + if os.path.split( uploaded_file_name )[ -1 ] == rt_util.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME: # Inspect the contents of the file to see if changeset_revision values are missing and if so, set them appropriately. altered, root_elem, error_message = commit_util.handle_repository_dependencies_definition( trans, uploaded_file_name, @@ -430,7 +431,7 @@ elif altered: tmp_filename = xml_util.create_and_write_tmp_file( root_elem ) shutil.move( tmp_filename, uploaded_file_name ) - elif os.path.split( uploaded_file_name )[ -1 ] == suc.TOOL_DEPENDENCY_DEFINITION_FILENAME: + elif os.path.split( uploaded_file_name )[ -1 ] == rt_util.TOOL_DEPENDENCY_DEFINITION_FILENAME: # Inspect the contents of the file to see if changeset_revision values are missing and if so, set them appropriately. altered, root_elem, error_message = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name ) if error_message:
diff -r e3c0070b64bae25215e9a30822f6e7488e938969 -r d0979f737213cbc8e000a46f90a7cd5501c709d1 lib/galaxy/webapps/tool_shed/framework/middleware/hg.py --- a/lib/galaxy/webapps/tool_shed/framework/middleware/hg.py +++ b/lib/galaxy/webapps/tool_shed/framework/middleware/hg.py @@ -131,7 +131,7 @@ # We possibly found an altered file entry. filename, change_list = entry if filename and isinstance( filename, str ): - if filename == suc.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME: + if filename == rt_util.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME: # Make sure the any complex repository dependency definitions contain valid <repository> tags. is_valid, error_msg = commit_util.repository_tags_are_valid( filename, change_list ) if not is_valid: @@ -150,7 +150,7 @@ # We possibly found an altered file entry. filename, change_list = entry if filename and isinstance( filename, str ): - if filename == suc.TOOL_DEPENDENCY_DEFINITION_FILENAME: + if filename == rt_util.TOOL_DEPENDENCY_DEFINITION_FILENAME: # Make sure the any complex repository dependency definitions contain valid <repository> tags. is_valid, error_msg = commit_util.repository_tags_are_valid( filename, change_list ) if not is_valid: @@ -171,8 +171,8 @@ # We possibly found an altered file entry. filename, change_list = entry if filename and isinstance( filename, str ): - if filename in [ suc.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME, - suc.TOOL_DEPENDENCY_DEFINITION_FILENAME ]: + if filename in [ rt_util.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME, + rt_util.TOOL_DEPENDENCY_DEFINITION_FILENAME ]: # We check both files since tool dependency definitions files can contain complex # repository dependency definitions. is_valid, error_msg = commit_util.repository_tags_are_valid( filename, change_list )
diff -r e3c0070b64bae25215e9a30822f6e7488e938969 -r d0979f737213cbc8e000a46f90a7cd5501c709d1 lib/tool_shed/repository_types/util.py --- a/lib/tool_shed/repository_types/util.py +++ b/lib/tool_shed/repository_types/util.py @@ -3,9 +3,11 @@
log = logging.getLogger( __name__ )
-UNRESTRICTED = 'unrestricted' +REPOSITORY_DEPENDENCY_DEFINITION_FILENAME = 'repository_dependencies.xml' REPOSITORY_SUITE_DEFINITION = 'repository_suite_definition' TOOL_DEPENDENCY_DEFINITION = 'tool_dependency_definition' +TOOL_DEPENDENCY_DEFINITION_FILENAME = 'tool_dependencies.xml' +UNRESTRICTED = 'unrestricted'
types = [ UNRESTRICTED, TOOL_DEPENDENCY_DEFINITION, REPOSITORY_SUITE_DEFINITION ]
@@ -31,3 +33,22 @@ else: repository_type_select_field.add_option( option_label, option_value, selected=selected ) return repository_type_select_field + +def generate_message_for_repository_type_change( app, repository ): + message = '' + if repository.can_change_type_to( app, REPOSITORY_SUITE_DEFINITION ): + repository_suite_definition_type_class = \ + app.repository_types_registry.get_class_by_label( REPOSITORY_SUITE_DEFINITION ) + message += "This repository currently contains a single file named <b>%s</b>. If the intent of this repository is " % \ + REPOSITORY_DEPENDENCY_DEFINITION_FILENAME + message += "to define relationships to a collection of repositories that contain related Galaxy utilities with " + message += "no plans to add additional files, consider setting its type to <b>%s</b>.<br/>" % \ + repository_suite_definition_type_class.label + elif repository.can_change_type_to( app, TOOL_DEPENDENCY_DEFINITION ): + tool_dependency_definition_type_class = \ + app.repository_types_registry.get_class_by_label( TOOL_DEPENDENCY_DEFINITION ) + message += "This repository currently contains a single file named <b>%s</b>. If additional files will " % \ + TOOL_DEPENDENCY_DEFINITION_FILENAME + message += "not be added to this repository, consider setting its type to <b>%s</b>.<br/>" % \ + tool_dependency_definition_type_class.label + return message
diff -r e3c0070b64bae25215e9a30822f6e7488e938969 -r d0979f737213cbc8e000a46f90a7cd5501c709d1 lib/tool_shed/util/commit_util.py --- a/lib/tool_shed/util/commit_util.py +++ b/lib/tool_shed/util/commit_util.py @@ -51,10 +51,10 @@ if member.name in [ 'hgrc' ]: message = "Uploaded archives cannot contain hgrc files." return False, message - if repository.type == rt_util.REPOSITORY_SUITE_DEFINITION and member.name != suc.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME: + if repository.type == rt_util.REPOSITORY_SUITE_DEFINITION and member.name != rt_util.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME: message = 'Repositories of type <b>Repsoitory suite definition</b> can contain only a single file named <b>repository_dependencies.xml</b>.' return False, message - if repository.type == rt_util.TOOL_DEPENDENCY_DEFINITION and member.name != suc.TOOL_DEPENDENCY_DEFINITION_FILENAME: + if repository.type == rt_util.TOOL_DEPENDENCY_DEFINITION and member.name != rt_util.TOOL_DEPENDENCY_DEFINITION_FILENAME: message = 'Repositories of type <b>Tool dependency definition</b> can contain only a single file named <b>tool_dependencies.xml</b>.' return False, message return True, ''
diff -r e3c0070b64bae25215e9a30822f6e7488e938969 -r d0979f737213cbc8e000a46f90a7cd5501c709d1 lib/tool_shed/util/export_util.py --- a/lib/tool_shed/util/export_util.py +++ b/lib/tool_shed/util/export_util.py @@ -7,6 +7,7 @@ from time import gmtime from time import strftime import tool_shed.util.shed_util_common as suc +import tool_shed.repository_types.util as rt_util from galaxy import eggs from galaxy import web from galaxy.util.odict import odict @@ -71,7 +72,9 @@ ordered_repositories = [] ordered_changeset_revisions = [] if repository: - repository_metadata = suc.get_current_repository_metadata_for_changeset_revision( trans, repository, changeset_revision ) + repository_metadata = suc.get_current_repository_metadata_for_changeset_revision( trans.app, + repository, + changeset_revision ) if repository_metadata: ordered_repository_ids = [ repository_id ] ordered_repositories = [ repository ] @@ -147,17 +150,19 @@ full_path = os.path.join( root, name ) relative_path = full_path.replace( work_dir, '' ).lstrip( '/' ) # See if we have a repository dependencies defined. - if name == suc.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME: + if name == rt_util.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME: # Eliminate the toolshed, and changeset_revision attributes from all <repository> tags. - altered, root_elem, error_message = commit_util.handle_repository_dependencies_definition( trans, full_path, unpopulate=True ) + altered, root_elem, error_message = \ + commit_util.handle_repository_dependencies_definition( trans, full_path, unpopulate=True ) if error_message: return None, error_message if altered: tmp_filename = xml_util.create_and_write_tmp_file( root_elem, use_indent=True ) shutil.move( tmp_filename, full_path ) - elif name == suc.TOOL_DEPENDENCY_DEFINITION_FILENAME: + elif name == rt_util.TOOL_DEPENDENCY_DEFINITION_FILENAME: # Eliminate the toolshed, and changeset_revision attributes from all <repository> tags. - altered, root_elem, error_message = commit_util.handle_tool_dependencies_definition( trans, full_path, unpopulate=True ) + altered, root_elem, error_message = \ + commit_util.handle_tool_dependencies_definition( trans, full_path, unpopulate=True ) if error_message: return None, error_message if altered: @@ -167,7 +172,8 @@ repository_archive.close() return repository_archive, error_message
-def generate_repository_archive_filename( tool_shed_url, name, owner, changeset_revision, file_type, export_repository_dependencies=False, use_tmp_archive_dir=False ): +def generate_repository_archive_filename( tool_shed_url, name, owner, changeset_revision, file_type, + export_repository_dependencies=False, use_tmp_archive_dir=False ): tool_shed = remove_protocol_from_tool_shed_url( tool_shed_url ) file_type_str = suc.get_file_type_str( changeset_revision, file_type ) if export_repository_dependencies: @@ -200,7 +206,9 @@ description, repository_clone_url, changeset_revision, ctx_rev, repository_owner, repository_dependencies, tool_dependencies = \ suc.get_repo_info_tuple_contents( repo_info_tup ) repository = suc.get_repository_by_name_and_owner( trans.app, repository_name, repository_owner ) - repository_metadata = suc.get_current_repository_metadata_for_changeset_revision( trans, repository, changeset_revision ) + repository_metadata = suc.get_current_repository_metadata_for_changeset_revision( trans.app, + repository, + changeset_revision ) if repository_metadata: return repository, repository_metadata.changeset_revision return None, None
diff -r e3c0070b64bae25215e9a30822f6e7488e938969 -r d0979f737213cbc8e000a46f90a7cd5501c709d1 lib/tool_shed/util/import_util.py --- a/lib/tool_shed/util/import_util.py +++ b/lib/tool_shed/util/import_util.py @@ -12,6 +12,7 @@ from tool_shed.util import metadata_util from tool_shed.util import xml_util import tool_shed.util.shed_util_common as suc +import tool_shed.repository_types.util as rt_util
from galaxy import eggs eggs.require( 'mercurial' ) @@ -240,7 +241,7 @@ archive.close() for filename in filenames_in_archive: uploaded_file_name = os.path.join( full_path, filename ) - if os.path.split( uploaded_file_name )[ -1 ] == suc.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME: + if os.path.split( uploaded_file_name )[ -1 ] == rt_util.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME: # Inspect the contents of the file to see if changeset_revision values are missing and if so, set them appropriately. altered, root_elem, error_message = commit_util.handle_repository_dependencies_definition( trans, uploaded_file_name, @@ -251,7 +252,7 @@ if altered: tmp_filename = xml_util.create_and_write_tmp_file( root_elem ) shutil.move( tmp_filename, uploaded_file_name ) - elif os.path.split( uploaded_file_name )[ -1 ] == suc.TOOL_DEPENDENCY_DEFINITION_FILENAME: + elif os.path.split( uploaded_file_name )[ -1 ] == rt_util.TOOL_DEPENDENCY_DEFINITION_FILENAME: # Inspect the contents of the file to see if changeset_revision values are missing and if so, set them appropriately. altered, root_elem, error_message = commit_util.handle_tool_dependencies_definition( trans, uploaded_file_name ) if error_message:
diff -r e3c0070b64bae25215e9a30822f6e7488e938969 -r d0979f737213cbc8e000a46f90a7cd5501c709d1 lib/tool_shed/util/metadata_util.py --- a/lib/tool_shed/util/metadata_util.py +++ b/lib/tool_shed/util/metadata_util.py @@ -39,8 +39,8 @@ SUBSET_VALUES = [ EQUAL, SUBSET ]
NOT_TOOL_CONFIGS = [ suc.DATATYPES_CONFIG_FILENAME, - suc.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME, - suc.TOOL_DEPENDENCY_DEFINITION_FILENAME, + rt_util.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME, + rt_util.TOOL_DEPENDENCY_DEFINITION_FILENAME, suc.REPOSITORY_DATA_MANAGER_CONFIG_FILENAME ]
def add_tool_versions( trans, id, repository_metadata, changeset_revisions ): @@ -49,7 +49,12 @@ tool_versions_dict = {} for tool_dict in metadata.get( 'tools', [] ): # We have at least 2 changeset revisions to compare tool guids and tool ids. - parent_id = get_parent_id( trans, id, tool_dict[ 'id' ], tool_dict[ 'version' ], tool_dict[ 'guid' ], changeset_revisions ) + parent_id = get_parent_id( trans.app, + id, + tool_dict[ 'id' ], + tool_dict[ 'version' ], + tool_dict[ 'guid' ], + changeset_revisions ) tool_versions_dict[ tool_dict[ 'guid' ] ] = parent_id if tool_versions_dict: repository_metadata.tool_versions = tool_versions_dict @@ -662,7 +667,7 @@ dirs.remove( '.hg' ) for name in files: # See if we have a repository dependencies defined. - if name == suc.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME: + if name == rt_util.REPOSITORY_DEPENDENCY_DEFINITION_FILENAME: path_to_repository_dependencies_config = os.path.join( root, name ) metadata_dict, error_message = \ generate_repository_dependency_metadata( app, @@ -1048,17 +1053,23 @@ repository = trans.sa_session.query( trans.model.Repository ).get( decoded_repository_id ) repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) if downloadable: - changeset_revision = suc.get_latest_downloadable_changeset_revision( trans.app, repository, repo ) + changeset_revision = suc.get_latest_downloadable_changeset_revision( trans.app, + repository, + repo ) else: - changeset_revision = suc.get_latest_changeset_revision( trans, repository, repo ) - return suc.get_repository_metadata_by_changeset_revision( trans.app, trans.security.encode_id( repository.id ), changeset_revision ) + changeset_revision = suc.get_latest_changeset_revision( trans.app, + repository, + repo ) + return suc.get_repository_metadata_by_changeset_revision( trans.app, + trans.security.encode_id( repository.id ), + changeset_revision )
-def get_parent_id( trans, id, old_id, version, guid, changeset_revisions ): +def get_parent_id( app, id, old_id, version, guid, changeset_revisions ): parent_id = None # Compare from most recent to oldest. changeset_revisions.reverse() for changeset_revision in changeset_revisions: - repository_metadata = suc.get_repository_metadata_by_changeset_revision( trans.app, id, changeset_revision ) + repository_metadata = suc.get_repository_metadata_by_changeset_revision( app, id, changeset_revision ) metadata = repository_metadata.metadata tools_dicts = metadata.get( 'tools', [] ) for tool_dict in tools_dicts: @@ -1709,7 +1720,7 @@ tool_versions_dict[ tool_dict[ 'guid' ] ] = tool_dict[ 'id' ] else: for tool_dict in tool_dicts: - parent_id = get_parent_id( trans, + parent_id = get_parent_id( trans.app, id, tool_dict[ 'id' ], tool_dict[ 'version' ],
diff -r e3c0070b64bae25215e9a30822f6e7488e938969 -r d0979f737213cbc8e000a46f90a7cd5501c709d1 lib/tool_shed/util/shed_util_common.py --- a/lib/tool_shed/util/shed_util_common.py +++ b/lib/tool_shed/util/shed_util_common.py @@ -39,8 +39,6 @@ MAX_DISPLAY_SIZE = 32768 DATATYPES_CONFIG_FILENAME = 'datatypes_conf.xml' REPOSITORY_DATA_MANAGER_CONFIG_FILENAME = 'data_manager_conf.xml' -REPOSITORY_DEPENDENCY_DEFINITION_FILENAME = 'repository_dependencies.xml' -TOOL_DEPENDENCY_DEFINITION_FILENAME = 'tool_dependencies.xml'
new_repo_email_alert_template = """ Sharable link: ${sharable_link} @@ -129,9 +127,9 @@ tool_dependencies_select_field.add_option( option_label, option_value ) return tool_dependencies_select_field
-def changeset_is_malicious( trans, id, changeset_revision, **kwd ): +def changeset_is_malicious( app, id, changeset_revision, **kwd ): """Check the malicious flag in repository metadata for a specified change set""" - repository_metadata = get_repository_metadata_by_changeset_revision( trans.app, id, changeset_revision ) + repository_metadata = get_repository_metadata_by_changeset_revision( app, id, changeset_revision ) if repository_metadata: return repository_metadata.malicious return False @@ -258,25 +256,6 @@ components_list = [ toolshed, name, owner, changeset_revision, prior_installation_required, only_if_compiling_contained_td ] return components_list
-def generate_message_for_repository_type_change( trans, repository ): - message = '' - if repository.can_change_type_to( trans.app, rt_util.REPOSITORY_SUITE_DEFINITION ): - repository_suite_definition_type_class = \ - trans.app.repository_types_registry.get_class_by_label( rt_util.REPOSITORY_SUITE_DEFINITION ) - message += "This repository currently contains a single file named <b>%s</b>. If the intent of this repository is " % \ - REPOSITORY_DEPENDENCY_DEFINITION_FILENAME - message += "to define relationships to a collection of repositories that contain related Galaxy utilities with " - message += "no plans to add additional files, consider setting its type to <b>%s</b>.<br/>" % \ - repository_suite_definition_type_class.label - 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 " % \ - TOOL_DEPENDENCY_DEFINITION_FILENAME - message += "not be added to this repository, consider setting its type to <b>%s</b>.<br/>" % \ - tool_dependency_definition_type_class.label - return message - def generate_repository_info_elem( tool_shed, repository_name, changeset_revision, owner, parent_elem=None, **kwd ): """Create and return an ElementTree repository info Element.""" if parent_elem is None: @@ -306,7 +285,7 @@ parent_elem=parent_elem, **kwd )
-def generate_sharable_link_for_repository_in_tool_shed( trans, repository, changeset_revision=None ): +def generate_sharable_link_for_repository_in_tool_shed( repository, changeset_revision=None ): """Generate the URL for sharing a repository that is in the tool shed.""" base_url = url_for( '/', qualified=True ).rstrip( '/' ) protocol, base = base_url.split( '://' ) @@ -486,16 +465,23 @@ return manifest_ctx, ctx_file return None, None
-def get_current_repository_metadata_for_changeset_revision( trans, repository, changeset_revision ): - encoded_repository_id = trans.security.encode_id( repository.id ) - repository_metadata = get_repository_metadata_by_changeset_revision( trans.app, encoded_repository_id, changeset_revision ) +def get_current_repository_metadata_for_changeset_revision( app, repository, changeset_revision ): + encoded_repository_id = app.security.encode_id( repository.id ) + repository_metadata = get_repository_metadata_by_changeset_revision( app, + encoded_repository_id, + changeset_revision ) if repository_metadata: return repository_metadata - # The installable changeset_revision may have been changed because it was "moved ahead" in the repository changelog. - repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( trans.app ) ) - updated_changeset_revision = get_next_downloadable_changeset_revision( repository, repo, after_changeset_revision=changeset_revision ) + # The installable changeset_revision may have been changed because it was "moved ahead" + # in the repository changelog. + repo = hg.repository( hg_util.get_configured_ui(), repository.repo_path( app ) ) + updated_changeset_revision = get_next_downloadable_changeset_revision( repository, + repo, + after_changeset_revision=changeset_revision ) if updated_changeset_revision: - repository_metadata = get_repository_metadata_by_changeset_revision( trans.app, encoded_repository_id, updated_changeset_revision ) + repository_metadata = get_repository_metadata_by_changeset_revision( app, + encoded_repository_id, + updated_changeset_revision ) if repository_metadata: return repository_metadata return None @@ -608,9 +594,11 @@ """Get a tool shed repository record from the Galaxy database defined by the id.""" return trans.install_model.context.query( trans.install_model.ToolShedRepository ).get( trans.security.decode_id( id ) )
-def get_latest_changeset_revision( trans, repository, repo ): - repository_tip = repository.tip( trans.app ) - repository_metadata = get_repository_metadata_by_changeset_revision( trans.app, trans.security.encode_id( repository.id ), repository_tip ) +def get_latest_changeset_revision( app, repository, repo ): + repository_tip = repository.tip( app ) + repository_metadata = get_repository_metadata_by_changeset_revision( app, + app.security.encode_id( repository.id ), + repository_tip ) if repository_metadata and repository_metadata.downloadable: return repository_tip changeset_revisions = get_ordered_metadata_changeset_revisions( repository, repo, downloadable=False ) @@ -1403,7 +1391,7 @@ """ repo_dir = repository.repo_path( trans.app ) repo = hg.repository( hg_util.get_configured_ui(), repo_dir ) - sharable_link = generate_sharable_link_for_repository_in_tool_shed( trans, repository, changeset_revision=None ) + sharable_link = generate_sharable_link_for_repository_in_tool_shed( repository, changeset_revision=None ) smtp_server = trans.app.config.smtp_server if smtp_server and ( new_repo_alert or repository.email_alerts ): # Send email alert to users that want them.
diff -r e3c0070b64bae25215e9a30822f6e7488e938969 -r d0979f737213cbc8e000a46f90a7cd5501c709d1 templates/webapps/tool_shed/common/repository_actions_menu.mako --- a/templates/webapps/tool_shed/common/repository_actions_menu.mako +++ b/templates/webapps/tool_shed/common/repository_actions_menu.mako @@ -27,7 +27,7 @@ else: is_new = False
- if changeset_is_malicious( trans, trans.security.encode_id( repository.id ), repository.tip( trans.app ) ): + if changeset_is_malicious( trans.app, trans.security.encode_id( repository.id ), repository.tip( trans.app ) ): is_malicious = True else: is_malicious = False
diff -r e3c0070b64bae25215e9a30822f6e7488e938969 -r d0979f737213cbc8e000a46f90a7cd5501c709d1 templates/webapps/tool_shed/repository/common.mako --- a/templates/webapps/tool_shed/repository/common.mako +++ b/templates/webapps/tool_shed/repository/common.mako @@ -208,7 +208,7 @@ <%def name="render_sharable_str( repository, changeset_revision=None )"><% from tool_shed.util.shed_util_common import generate_sharable_link_for_repository_in_tool_shed - sharable_link = generate_sharable_link_for_repository_in_tool_shed( trans, repository, changeset_revision=changeset_revision ) + sharable_link = generate_sharable_link_for_repository_in_tool_shed( repository, changeset_revision=changeset_revision ) %> ${sharable_link} </%def>
diff -r e3c0070b64bae25215e9a30822f6e7488e938969 -r d0979f737213cbc8e000a46f90a7cd5501c709d1 templates/webapps/tool_shed/repository/manage_repository.mako --- a/templates/webapps/tool_shed/repository/manage_repository.mako +++ b/templates/webapps/tool_shed/repository/manage_repository.mako @@ -22,7 +22,7 @@ else: is_deprecated = False
- if changeset_is_malicious( trans, trans.security.encode_id( repository.id ), repository.tip( trans.app ) ): + if changeset_is_malicious( trans.app, trans.security.encode_id( repository.id ), repository.tip( trans.app ) ): is_malicious = True else: is_malicious = False
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.
galaxy-commits@lists.galaxyproject.org