Пример #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
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)