Warning

This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

Source code for tool_shed.repository_types.tool_dependency_definition

import logging

import tool_shed.repository_types.util as rt_util
from galaxy.util import unicodify
from tool_shed.repository_types.metadata import TipOnly
from tool_shed.util import basic_util

log = logging.getLogger(__name__)


[docs]class ToolDependencyDefinition(TipOnly):
[docs] def __init__(self): self.type = rt_util.TOOL_DEPENDENCY_DEFINITION self.label = 'Tool dependency definition' self.valid_file_names = ['tool_dependencies.xml']
[docs] def is_valid_for_type(self, repository, revisions_to_check=None): """ Inspect the received repository's contents to determine if they abide by the rules defined for the contents of this type. If the received revisions_to_check is a list of changeset revisions, then inspection will be restricted to the revisions in the list. """ repo = repository.hg_repo if revisions_to_check: changeset_revisions = revisions_to_check else: changeset_revisions = repo.changelog for changeset in changeset_revisions: ctx = repo[changeset] # Inspect all files in the changeset (in sorted order) to make sure there is only one and it is named tool_dependencies.xml. files_changed_in_changeset = ctx.files() for file_path in files_changed_in_changeset: file_name = basic_util.strip_path(unicodify(file_path)) if file_name not in self.valid_file_names: return False return True