예제 #1
0
def handle_tool_load_error(tool_path, tool_xml):
    """ Return True if tool_xml is tool load error (invalid XML), and
    print a helpful error message.
    """
    is_error = False
    if is_tool_load_error(tool_xml):
        info("Could not lint %s due to malformed xml." % tool_path)
        is_error = True
    return is_error
예제 #2
0
파일: tool_lint.py 프로젝트: davebx/planemo
def handle_tool_load_error(tool_path, tool_xml):
    """ Return True if tool_xml is tool load error (invalid XML), and
    print a helpful error message.
    """
    is_error = False
    if is_tool_load_error(tool_xml):
        info("Could not lint %s due to malformed xml." % tool_path)
        is_error = True
    return is_error
예제 #3
0
def yield_tool_xmls(ctx, path, recursive=False):
    tools = load_tool_elements_from_path(path, recursive, register_load_errors=True)
    for (tool_path, tool_xml) in tools:
        if is_tool_load_error(tool_xml):
            yield (tool_path, tool_xml)
            continue
        if not _is_tool_xml(ctx, tool_path, tool_xml):
            continue
        yield (tool_path, tool_xml)
예제 #4
0
def yield_tool_xmls(ctx, path, recursive=False):
    tools = load_tool_elements_from_path(
        path,
        recursive,
        register_load_errors=True,
    )
    for (tool_path, tool_xml) in tools:
        if is_tool_load_error(tool_xml):
            yield (tool_path, tool_xml)
            continue
        if not _is_tool_xml(ctx, tool_path, tool_xml):
            continue
        yield (tool_path, tool_xml)
예제 #5
0
def yield_tool_sources(ctx, path, recursive=False):
    tools = load_tool_sources_from_path(
        path,
        recursive,
        register_load_errors=True,
    )
    for (tool_path, tool_source) in tools:
        if is_tool_load_error(tool_source):
            yield (tool_path, tool_source)
            continue
        if not _is_tool_source(ctx, tool_path, tool_source):
            continue
        yield (tool_path, tool_source)
예제 #6
0
def cli(ctx, paths, **kwds):
    """Find all tools in one or more directories.

    Tools can be chunked up, filtered, etc... to build lists of tools to perform
    operations over for continuous integration operations.
    """
    tool_paths = []
    for (tool_path, tool_source) in yield_tool_sources_on_paths(ctx, paths, recursive=True):
        if is_tool_load_error(tool_source):
            continue
        tool_paths.append(tool_path)

    paths = filter_paths(ctx, tool_paths, path_type="file", **kwds)
    print_path_list(paths, **kwds)