'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.'

def get_prior_installation_required_and_only_if_compiling_contained_td(self):

    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:
        metadata = self.repository_metadata.metadata
        current_changeset_revision = str(self.repository_metadata.changeset_revision)
        text = metadata_util.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)
    return ('False', 'False')
