本文整理汇总了Python中tool_shed.util.common_util.parse_repository_dependency_tuple函数的典型用法代码示例。如果您正苦于以下问题:Python parse_repository_dependency_tuple函数的具体用法?Python parse_repository_dependency_tuple怎么用?Python parse_repository_dependency_tuple使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_repository_dependency_tuple函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: remove_repository_dependency_reference_to_self
def remove_repository_dependency_reference_to_self( self, key_rd_dicts ):
"""Remove all repository dependencies that point to a revision within its own repository."""
clean_key_rd_dicts = []
key = next(iter(key_rd_dicts[ 0 ]))
repository_tup = key.split( container_util.STRSEP )
rd_toolshed, rd_name, rd_owner, rd_changeset_revision, \
rd_prior_installation_required, \
rd_only_if_compiling_contained_td = \
common_util.parse_repository_dependency_tuple( repository_tup )
cleaned_rd_toolshed = common_util.remove_protocol_from_tool_shed_url( rd_toolshed )
for key_rd_dict in key_rd_dicts:
k = next(iter(key_rd_dict))
repository_dependency = key_rd_dict[ k ]
toolshed, name, owner, changeset_revision, prior_installation_required, only_if_compiling_contained_td = \
common_util.parse_repository_dependency_tuple( repository_dependency )
cleaned_toolshed = common_util.remove_protocol_from_tool_shed_url( toolshed )
if cleaned_rd_toolshed == cleaned_toolshed and rd_name == name and rd_owner == owner:
debug_msg = "Removing repository dependency for repository %s owned by %s " % ( name, owner )
debug_msg += 'since it refers to a revision within itself.'
log.debug( debug_msg )
else:
new_key_rd_dict = {}
new_key_rd_dict[ key ] = repository_dependency
clean_key_rd_dicts.append( new_key_rd_dict )
return clean_key_rd_dicts
开发者ID:ashvark,项目名称:galaxy,代码行数:25,代码来源:relation_builder.py
示例2: requires_prior_installation_of
def requires_prior_installation_of( self ):
"""
Return a list of repository dependency tuples like (tool_shed, name, owner, changeset_revision, prior_installation_required) for this
repository's repository dependencies where prior_installation_required is True. By definition, repository dependencies are required to
be installed in order for this repository to function correctly. However, those repository dependencies that are defined for this
repository with prior_installation_required set to True place them in a special category in that the required repositories must be
installed before this repository is installed. Among other things, this enables these "special" repository dependencies to include
information that enables the successful installation of this repository. This method is not used during the initial installation of
this repository, but only after it has been installed (metadata must be set for this repository in order for this method to be useful).
"""
required_rd_tups_that_must_be_installed = []
if self.has_repository_dependencies:
rd_tups = self.metadata[ 'repository_dependencies' ][ 'repository_dependencies' ]
for rd_tup in rd_tups:
if len( rd_tup ) == 5:
tool_shed, name, owner, changeset_revision, prior_installation_required, only_if_compiling_contained_td = \
common_util.parse_repository_dependency_tuple( rd_tup, contains_error=False )
if asbool( prior_installation_required ):
required_rd_tups_that_must_be_installed.append( ( tool_shed, name, owner, changeset_revision, 'True', 'False' ) )
elif len( rd_tup ) == 6:
tool_shed, name, owner, changeset_revision, prior_installation_required, only_if_compiling_contained_td = \
common_util.parse_repository_dependency_tuple( rd_tup, contains_error=False )
# The repository dependency will only be required to be previously installed if it does not fall into the category of
# a repository that must be installed only so that its contained tool dependency can be used for compiling the tool
# dependency of the dependent repository.
if not asbool( only_if_compiling_contained_td ):
if asbool( prior_installation_required ):
required_rd_tups_that_must_be_installed.append( ( tool_shed, name, owner, changeset_revision, 'True', 'False' ) )
return required_rd_tups_that_must_be_installed
开发者ID:ashvark,项目名称:galaxy,代码行数:29,代码来源:__init__.py
示例3: get_prior_installation_required_and_only_if_compiling_contained_td
def get_prior_installation_required_and_only_if_compiling_contained_td( self ):
"""
This method is called from the tool shed and never Galaxy. If self.all_repository_dependencies
contains a repository dependency tuple that is associated with self.repository, return the
value of the tuple's prior_installation_required component.
"""
cleaned_toolshed_base_url = common_util.remove_protocol_from_tool_shed_url( self.tool_shed_url )
if self.all_repository_dependencies:
for rd_key, rd_tups in self.all_repository_dependencies.items():
if rd_key in [ 'root_key', 'description' ]:
continue
for rd_tup in rd_tups:
rd_toolshed, \
rd_name, \
rd_owner, \
rd_changeset_revision, \
rd_prior_installation_required, \
rd_only_if_compiling_contained_td = \
common_util.parse_repository_dependency_tuple( rd_tup )
cleaned_rd_toolshed = common_util.remove_protocol_from_tool_shed_url( rd_toolshed )
if cleaned_rd_toolshed == cleaned_toolshed_base_url and \
rd_name == self.repository.name and \
rd_owner == self.repository.user.username and \
rd_changeset_revision == self.repository_metadata.changeset_revision:
return rd_prior_installation_required, rd_only_if_compiling_contained_td
elif self.repository_metadata:
# Get the list of changeset revisions from the tool shed to which self.repository may be updated.
metadata = self.repository_metadata.metadata
current_changeset_revision = str( self.repository_metadata.changeset_revision )
# Get the changeset revision to which the current value of required_repository_changeset_revision
# should be updated if it's not current.
text = suc.get_updated_changeset_revisions( self.app,
name=str( self.repository.name ),
owner=str( self.repository.user.username ),
changeset_revision=current_changeset_revision )
if text:
valid_changeset_revisions = listify( text )
if current_changeset_revision not in valid_changeset_revisions:
valid_changeset_revisions.append( current_changeset_revision )
else:
valid_changeset_revisions = [ current_changeset_revision ]
repository_dependencies_dict = metadata[ 'repository_dependencies' ]
rd_tups = repository_dependencies_dict.get( 'repository_dependencies', [] )
for rd_tup in rd_tups:
rd_toolshed, \
rd_name, \
rd_owner, \
rd_changeset_revision, \
rd_prior_installation_required, \
rd_only_if_compiling_contained_td = \
common_util.parse_repository_dependency_tuple( rd_tup )
cleaned_rd_toolshed = common_util.remove_protocol_from_tool_shed_url( rd_toolshed )
if cleaned_rd_toolshed == cleaned_toolshed_base_url and \
rd_name == self.repository.name and \
rd_owner == self.repository.user.username and \
rd_changeset_revision in valid_changeset_revisions:
return rd_prior_installation_required, rd_only_if_compiling_contained_td
# Default both prior_installation_required and only_if_compiling_contained_td to False.
return 'False', 'False'
开发者ID:BinglanLi,项目名称:galaxy,代码行数:59,代码来源:relation_builder.py
示例4: generate_message_for_invalid_repository_dependencies
def generate_message_for_invalid_repository_dependencies( self, metadata_dict, error_from_tuple=False ):
"""
Get or generate and return an error message associated with an invalid repository dependency.
"""
message = ''
if metadata_dict:
if error_from_tuple:
# Return the error messages associated with a set of one or more invalid repository
# dependency tuples.
invalid_repository_dependencies_dict = metadata_dict.get( 'invalid_repository_dependencies', None )
if invalid_repository_dependencies_dict is not None:
invalid_repository_dependencies = \
invalid_repository_dependencies_dict.get( 'invalid_repository_dependencies', [] )
for repository_dependency_tup in invalid_repository_dependencies:
toolshed, \
name, \
owner, \
changeset_revision, \
prior_installation_required, \
only_if_compiling_contained_td, error = \
common_util.parse_repository_dependency_tuple( repository_dependency_tup, contains_error=True )
if error:
message += '%s ' % str( error )
else:
# The complete dependency hierarchy could not be determined for a repository being installed into
# Galaxy. This is likely due to invalid repository dependency definitions, so we'll get them from
# the metadata and parse them for display in an error message. This will hopefully communicate the
# problem to the user in such a way that a resolution can be determined.
message += 'The complete dependency hierarchy could not be determined for this repository, so no required '
message += 'repositories will not be installed. This is likely due to invalid repository dependency definitions. '
repository_dependencies_dict = metadata_dict.get( 'repository_dependencies', None )
if repository_dependencies_dict is not None:
rd_tups = repository_dependencies_dict.get( 'repository_dependencies', None )
if rd_tups is not None:
message += 'Here are the attributes of the dependencies defined for this repository to help determine the '
message += 'cause of this problem.<br/>'
message += '<table cellpadding="2" cellspacing="2">'
message += '<tr><th>Tool shed</th><th>Repository name</th><th>Owner</th><th>Changeset revision</th>'
message += '<th>Prior install required</th></tr>'
for rd_tup in rd_tups:
tool_shed, name, owner, changeset_revision, pir, oicct = \
common_util.parse_repository_dependency_tuple( rd_tup )
if util.asbool( pir ):
pir_str = 'True'
else:
pir_str = ''
message += '<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>' % \
( tool_shed, name, owner, changeset_revision, pir_str )
message += '</table>'
return message
开发者ID:BinglanLi,项目名称:galaxy,代码行数:50,代码来源:dependency_display.py
示例5: handle_key_rd_dicts_for_repository
def handle_key_rd_dicts_for_repository( self, current_repository_key, repository_key_rd_dicts ):
key_rd_dict = repository_key_rd_dicts.pop( 0 )
repository_dependency = key_rd_dict[ current_repository_key ]
toolshed, name, owner, changeset_revision, prior_installation_required, only_if_compiling_contained_td = \
common_util.parse_repository_dependency_tuple( repository_dependency )
if suc.tool_shed_is_this_tool_shed( toolshed ):
required_repository = tool_shed.util.repository_util.get_repository_by_name_and_owner( self.app, name, owner )
self.repository = required_repository
repository_id = self.app.security.encode_id( required_repository.id )
required_repository_metadata = \
metadata_util.get_repository_metadata_by_repository_id_changeset_revision( self.app,
repository_id,
changeset_revision )
self.repository_metadata = required_repository_metadata
if required_repository_metadata:
# The required_repository_metadata changeset_revision is installable.
required_metadata = required_repository_metadata.metadata
if required_metadata:
for current_repository_key_rd_dict in repository_key_rd_dicts:
if not self.in_key_rd_dicts( current_repository_key_rd_dict, self.key_rd_dicts_to_be_processed ):
# Add the current repository_dependency into self.key_rd_dicts_to_be_processed.
self.key_rd_dicts_to_be_processed.append( current_repository_key_rd_dict )
if not self.in_key_rd_dicts( key_rd_dict, self.handled_key_rd_dicts ):
# Add the current repository_dependency into self.handled_key_rd_dicts.
self.handled_key_rd_dicts.append( key_rd_dict )
if self.in_key_rd_dicts( key_rd_dict, self.key_rd_dicts_to_be_processed ):
# Remove the current repository from self.key_rd_dicts_to_be_processed.
self.key_rd_dicts_to_be_processed = self.remove_from_key_rd_dicts( key_rd_dict, self.key_rd_dicts_to_be_processed )
else:
# The repository is in a different tool shed, so build an url and send a request.
error_message = "Repository dependencies are currently supported only within the same Tool Shed. "
error_message += "Ignoring repository dependency definition for tool shed "
error_message += "%s, name %s, owner %s, changeset revision %s" % ( toolshed, name, owner, changeset_revision )
log.debug( error_message )
开发者ID:ashvark,项目名称:galaxy,代码行数:34,代码来源:relation_builder.py
示例6: get_repository_dependency_tups_from_repository_metadata
def get_repository_dependency_tups_from_repository_metadata( app, repository_metadata, deprecated_only=False ):
"""
Return a list of of tuples defining repository objects required by the received repository. The returned
list defines the entire repository dependency tree. This method is called only from the Tool Shed.
"""
dependency_tups = []
if repository_metadata is not None:
metadata = repository_metadata.metadata
if metadata:
repository_dependencies_dict = metadata.get( 'repository_dependencies', None )
if repository_dependencies_dict is not None:
repository_dependency_tups = repository_dependencies_dict.get( 'repository_dependencies', None )
if repository_dependency_tups is not None:
# The value of repository_dependency_tups is a list of repository dependency tuples like this:
# ['http://localhost:9009', 'package_samtools_0_1_18', 'devteam', 'ef37fc635cb9', 'False', 'False']
for repository_dependency_tup in repository_dependency_tups:
toolshed, name, owner, changeset_revision, pir, oicct = \
common_util.parse_repository_dependency_tuple( repository_dependency_tup )
repository = tool_shed.util.repository_util.get_repository_by_name_and_owner( app, name, owner )
if repository:
if deprecated_only:
if repository.deprecated:
dependency_tups.append( repository_dependency_tup )
else:
dependency_tups.append( repository_dependency_tup )
else:
log.debug( "Cannot locate repository %s owned by %s for inclusion in repository dependency tups." %
( name, owner ) )
return dependency_tups
开发者ID:AAFC-MBB,项目名称:galaxy-1,代码行数:29,代码来源:metadata_util.py
示例7: render_render_deprecated_repository_dependencies_message
def render_render_deprecated_repository_dependencies_message(context,deprecated_repository_dependency_tups):
context.caller_stack._push_frame()
try:
__M_writer = context.writer()
# SOURCE LINE 54
__M_writer(u'\n <div class="warningmessage">\n ')
# SOURCE LINE 56
from tool_shed.util.common_util import parse_repository_dependency_tuple
msg = '<ul>'
for deprecated_repository_dependency_tup in deprecated_repository_dependency_tups:
toolshed, name, owner, changeset_revision, pir, oicct = \
parse_repository_dependency_tuple( deprecated_repository_dependency_tup )
msg += '<li>Revision <b>%s</b> of repository <b>%s</b> owned by <b>%s</b></li>' % \
( changeset_revision, name, owner )
msg += '</ul>'
# SOURCE LINE 65
__M_writer(u'\n This repository depends upon the following deprecated repositories<br/>\n ')
# SOURCE LINE 67
__M_writer(unicode(msg))
__M_writer(u'\n </div>\n')
return ''
finally:
context.caller_stack._pop_frame()
开发者ID:mvollger,项目名称:galaxy,代码行数:26,代码来源:common.mako.py
示例8: create_or_update_tool_shed_repository_records
def create_or_update_tool_shed_repository_records( self, name, changeset_revision, repository_dependencies_dict ):
"""
Make sure the repository defined by name and changeset_revision and all of its repository dependencies have
associated tool_shed_repository table rows in the Galaxy database.
"""
created_tool_shed_repositories = []
description = repository_dependencies_dict.get( 'description', None )
tool_shed_repository = self.create_or_update_tool_shed_repository_record( name,
self.repository_owner,
changeset_revision,
description=description )
if tool_shed_repository:
created_tool_shed_repositories.append( tool_shed_repository )
for rd_key, rd_tups in repository_dependencies_dict.items():
if rd_key in [ 'root_key', 'description' ]:
continue
for rd_tup in rd_tups:
parsed_rd_tup = common_util.parse_repository_dependency_tuple( rd_tup )
rd_tool_shed, rd_name, rd_owner, rd_changeset_revision = parsed_rd_tup[ 0:4 ]
# TODO: Make sure the repository description is applied to the new repository record during installation.
tool_shed_repository = self.create_or_update_tool_shed_repository_record( rd_name,
rd_owner,
rd_changeset_revision,
description=None )
if tool_shed_repository:
created_tool_shed_repositories.append( tool_shed_repository )
return created_tool_shed_repositories
开发者ID:HullUni-bioinformatics,项目名称:ReproPhyloGalaxy,代码行数:27,代码来源:tool_migration_manager.py
示例9: get_repository_dependency_as_key
def get_repository_dependency_as_key( self, repository_dependency ):
tool_shed, name, owner, changeset_revision, prior_installation_required, only_if_compiling_contained_td = \
common_util.parse_repository_dependency_tuple( repository_dependency )
return container_util.generate_repository_dependencies_key_for_repository( tool_shed,
name,
owner,
changeset_revision,
prior_installation_required,
only_if_compiling_contained_td )
开发者ID:ashvark,项目名称:galaxy,代码行数:9,代码来源:relation_builder.py
示例10: has_repository_dependencies
def has_repository_dependencies( self ):
if self.metadata:
repository_dependencies_dict = self.metadata.get( 'repository_dependencies', {} )
repository_dependencies = repository_dependencies_dict.get( 'repository_dependencies', [] )
# [["http://localhost:9009", "package_libgtextutils_0_6", "test", "e2003cbf18cd", "True", "True"]]
for rd_tup in repository_dependencies:
tool_shed, name, owner, changeset_revision, prior_installation_required, only_if_compiling_contained_td = \
common_util.parse_repository_dependency_tuple( rd_tup )
if not asbool( only_if_compiling_contained_td ):
return True
return False
开发者ID:ashvark,项目名称:galaxy,代码行数:11,代码来源:__init__.py
示例11: is_subfolder_of
def is_subfolder_of( self, folder, repository_dependency ):
toolshed, repository_name, repository_owner, changeset_revision, prior_installation_required, only_if_compiling_contained_td = \
common_util.parse_repository_dependency_tuple( repository_dependency )
key = container_util.generate_repository_dependencies_key_for_repository( toolshed,
repository_name,
repository_owner,
changeset_revision,
prior_installation_required,
only_if_compiling_contained_td )
for sub_folder in folder.folders:
if key == sub_folder.key:
return True
return False
开发者ID:AbhishekKumarSingh,项目名称:galaxy,代码行数:13,代码来源:utility_container_manager.py
示例12: filter_only_if_compiling_contained_td
def filter_only_if_compiling_contained_td( self, key_rd_dict ):
"""
Return a copy of the received key_rd_dict with repository dependencies that are needed
only_if_compiling_contained_td filtered out of the list of repository dependencies for
each rd_key.
"""
filtered_key_rd_dict = {}
for rd_key, required_rd_tup in key_rd_dict.items():
tool_shed, name, owner, changeset_revision, prior_installation_required, only_if_compiling_contained_td = \
common_util.parse_repository_dependency_tuple( required_rd_tup )
if not asbool( only_if_compiling_contained_td ):
filtered_key_rd_dict[ rd_key ] = required_rd_tup
return filtered_key_rd_dict
开发者ID:ashvark,项目名称:galaxy,代码行数:13,代码来源:relation_builder.py
示例13: can_eliminate_repository_dependency
def can_eliminate_repository_dependency(metadata_dict, tool_shed_url, name, owner):
"""
Determine if the relationship between a repository_dependency record
associated with a tool_shed_repository record on the Galaxy side
can be eliminated.
"""
rd_dict = metadata_dict.get('repository_dependencies', {})
rd_tups = rd_dict.get('repository_dependencies', [])
for rd_tup in rd_tups:
tsu, n, o, none1, none2, none3 = common_util.parse_repository_dependency_tuple(rd_tup)
if tsu == tool_shed_url and n == name and o == owner:
# The repository dependency is current, so keep it.
return False
return True
开发者ID:ImmPortDB,项目名称:immport-galaxy,代码行数:14,代码来源:shed_util_common.py
示例14: build_invalid_repository_dependencies_root_folder
def build_invalid_repository_dependencies_root_folder( self, folder_id, invalid_repository_dependencies_dict ):
"""Return a folder hierarchy containing invalid repository dependencies."""
label = 'Invalid repository dependencies'
if invalid_repository_dependencies_dict:
invalid_repository_dependency_id = 0
folder_id += 1
invalid_repository_dependencies_root_folder = \
utility_container_manager.Folder( id=folder_id,
key='root',
label='root',
parent=None )
folder_id += 1
invalid_repository_dependencies_folder = \
utility_container_manager.Folder( id=folder_id,
key='invalid_repository_dependencies',
label=label,
parent=invalid_repository_dependencies_root_folder )
invalid_repository_dependencies_root_folder.folders.append( invalid_repository_dependencies_folder )
invalid_repository_dependencies = invalid_repository_dependencies_dict[ 'repository_dependencies' ]
for invalid_repository_dependency in invalid_repository_dependencies:
folder_id += 1
invalid_repository_dependency_id += 1
toolshed, name, owner, changeset_revision, prior_installation_required, only_if_compiling_contained_td, error = \
common_util.parse_repository_dependency_tuple( invalid_repository_dependency, contains_error=True )
key = container_util.generate_repository_dependencies_key_for_repository( toolshed,
name,
owner,
changeset_revision,
prior_installation_required,
only_if_compiling_contained_td )
label = "Repository <b>%s</b> revision <b>%s</b> owned by <b>%s</b>" % ( name, changeset_revision, owner )
folder = utility_container_manager.Folder( id=folder_id,
key=key,
label=label,
parent=invalid_repository_dependencies_folder )
ird = InvalidRepositoryDependency( id=invalid_repository_dependency_id,
toolshed=toolshed,
repository_name=name,
repository_owner=owner,
changeset_revision=changeset_revision,
prior_installation_required=util.asbool( prior_installation_required ),
only_if_compiling_contained_td=util.asbool( only_if_compiling_contained_td ),
error=error )
folder.invalid_repository_dependencies.append( ird )
invalid_repository_dependencies_folder.folders.append( folder )
else:
invalid_repository_dependencies_root_folder = None
return folder_id, invalid_repository_dependencies_root_folder
开发者ID:AAFC-MBB,项目名称:galaxy-1,代码行数:48,代码来源:__init__.py
示例15: get_prior_install_required_dict
def get_prior_install_required_dict( self, tool_shed_repositories, repository_dependencies_dict ):
"""
Return 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.
"""
# Initialize the dictionary.
prior_install_required_dict = {}
tsr_ids = [ tool_shed_repository.id for tool_shed_repository in tool_shed_repositories ]
for tsr_id in tsr_ids:
prior_install_required_dict[ tsr_id ] = []
# Inspect the repository dependencies about to be installed and populate the dictionary.
for rd_key, rd_tups in repository_dependencies_dict.items():
if rd_key in [ 'root_key', 'description' ]:
continue
for rd_tup in rd_tups:
prior_install_ids = []
tool_shed, name, owner, changeset_revision, prior_installation_required, only_if_compiling_contained_td = \
common_util.parse_repository_dependency_tuple( rd_tup )
if util.asbool( prior_installation_required ):
for tsr in tool_shed_repositories:
if tsr.name == name and tsr.owner == owner and tsr.changeset_revision == changeset_revision:
prior_install_ids.append( tsr.id )
prior_install_required_dict[ tsr.id ] = prior_install_ids
return prior_install_required_dict
开发者ID:HullUni-bioinformatics,项目名称:ReproPhyloGalaxy,代码行数:24,代码来源:tool_migration_manager.py
示例16: build_repository_dependency_relationships
def build_repository_dependency_relationships( self, repo_info_dicts, tool_shed_repositories ):
"""
Build relationships between installed tool shed repositories and other installed
tool shed repositories upon which they depend. These relationships are defined in
the repository_dependencies entry for each dictionary in the received list of repo_info_dicts.
Each of these dictionaries is associated with a repository in the received tool_shed_repositories
list.
"""
install_model = self.app.install_model
log.debug( "Building repository dependency relationships..." )
for repo_info_dict in repo_info_dicts:
for name, repo_info_tuple in repo_info_dict.items():
description, \
repository_clone_url, \
changeset_revision, \
ctx_rev, \
repository_owner, \
repository_dependencies, \
tool_dependencies = \
suc.get_repo_info_tuple_contents( repo_info_tuple )
if repository_dependencies:
for key, val in repository_dependencies.items():
if key in [ 'root_key', 'description' ]:
continue
d_repository = None
repository_components_tuple = container_util.get_components_from_key( key )
components_list = suc.extract_components_from_tuple( repository_components_tuple )
d_toolshed, d_name, d_owner, d_changeset_revision = components_list[ 0:4 ]
for tsr in tool_shed_repositories:
# Get the the tool_shed_repository defined by name, owner and changeset_revision. This is
# the repository that will be dependent upon each of the tool shed repositories contained in
# val. We'll need to check tool_shed_repository.tool_shed as well if/when repository dependencies
# across tool sheds is supported.
if tsr.name == d_name and tsr.owner == d_owner and tsr.changeset_revision == d_changeset_revision:
d_repository = tsr
break
if d_repository is None:
# The dependent repository is not in the received list so look in the database.
d_repository = self.get_or_create_tool_shed_repository( d_toolshed,
d_name,
d_owner,
d_changeset_revision )
# Process each repository_dependency defined for the current dependent repository.
for repository_dependency_components_list in val:
required_repository = None
rd_toolshed, \
rd_name, \
rd_owner, \
rd_changeset_revision, \
rd_prior_installation_required, \
rd_only_if_compiling_contained_td = \
common_util.parse_repository_dependency_tuple( repository_dependency_components_list )
# Get the the tool_shed_repository defined by rd_name, rd_owner and rd_changeset_revision. This
# is the repository that will be required by the current d_repository.
# TODO: Check tool_shed_repository.tool_shed as well when repository dependencies across tool sheds is supported.
for tsr in tool_shed_repositories:
if tsr.name == rd_name and tsr.owner == rd_owner and tsr.changeset_revision == rd_changeset_revision:
required_repository = tsr
break
if required_repository is None:
# The required repository is not in the received list so look in the database.
required_repository = self.get_or_create_tool_shed_repository( rd_toolshed,
rd_name,
rd_owner,
rd_changeset_revision )
# Ensure there is a repository_dependency relationship between d_repository and required_repository.
rrda = None
for rd in d_repository.repository_dependencies:
if rd.id == required_repository.id:
rrda = rd
break
if not rrda:
# Make sure required_repository is in the repository_dependency table.
repository_dependency = self.get_repository_dependency_by_repository_id( install_model,
required_repository.id )
if not repository_dependency:
log.debug( 'Creating new repository_dependency record for installed revision %s of repository: %s owned by %s.' % \
( str( required_repository.installed_changeset_revision ),
str( required_repository.name ),
str( required_repository.owner ) ) )
repository_dependency = install_model.RepositoryDependency( tool_shed_repository_id=required_repository.id )
install_model.context.add( repository_dependency )
install_model.context.flush()
# Build the relationship between the d_repository and the required_repository.
rrda = install_model.RepositoryRepositoryDependencyAssociation( tool_shed_repository_id=d_repository.id,
repository_dependency_id=repository_dependency.id )
install_model.context.add( rrda )
install_model.context.flush()
开发者ID:HullUni-bioinformatics,项目名称:ReproPhyloGalaxy,代码行数:88,代码来源:repository_dependency_manager.py
示例17: handle_repository_dependencies_container_entry
def handle_repository_dependencies_container_entry( self, repository_dependencies_folder, rd_key, rd_value, folder_id,
repository_dependency_id, folder_keys ):
repository_components_tuple = container_util.get_components_from_key( rd_key )
components_list = suc.extract_components_from_tuple( repository_components_tuple )
toolshed, repository_name, repository_owner, changeset_revision = components_list[ 0:4 ]
# For backward compatibility to the 12/20/12 Galaxy release.
if len( components_list ) == 4:
prior_installation_required = 'False'
only_if_compiling_contained_td = 'False'
elif len( components_list ) == 5:
prior_installation_required = components_list[ 4 ]
only_if_compiling_contained_td = 'False'
elif len( components_list ) == 6:
prior_installation_required = components_list[ 4 ]
only_if_compiling_contained_td = components_list[ 5 ]
folder = self.get_folder( repository_dependencies_folder, rd_key )
label = self.generate_repository_dependencies_folder_label_from_key( repository_name,
repository_owner,
changeset_revision,
prior_installation_required,
only_if_compiling_contained_td,
repository_dependencies_folder.key )
if folder:
if rd_key not in folder_keys:
folder_id += 1
sub_folder = Folder( id=folder_id, key=rd_key, label=label, parent=folder )
folder.folders.append( sub_folder )
else:
sub_folder = folder
else:
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 self.app.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 self.app.name == 'galaxy':
tool_shed_repository_id, installation_status, repository_dependency = \
self.get_components_from_repository_dependency_for_installed_repository( repository_dependency )
else:
tool_shed_repository_id = None
installation_status = None
can_create_dependency = not self.is_subfolder_of( sub_folder, repository_dependency )
if can_create_dependency:
toolshed, repository_name, repository_owner, changeset_revision, prior_installation_required, only_if_compiling_contained_td = \
common_util.parse_repository_dependency_tuple( repository_dependency )
repository_dependency_id += 1
repository_dependency = RepositoryDependency( id=repository_dependency_id,
toolshed=toolshed,
repository_name=repository_name,
repository_owner=repository_owner,
changeset_revision=changeset_revision,
prior_installation_required=util.asbool( prior_installation_required ),
only_if_compiling_contained_td=util.asbool( only_if_compiling_contained_td ),
installation_status=installa
|
请发表评论