コード例 #1
0
def print_violations(data):
    ignore, dependencies = build_lib_dependencies(data)
    for dependency in dependencies:
        if dependency.src_lib in myConfig.dependencies and dependency.dst_lib in myConfig.dependencies[dependency.src_lib]:
            continue
        logging.warn("Dependency violation in file: " + dependency.src)
        logging.warn(" with the include: " + dependency.dst)
        logging.warn("  " + dependency.src_lib + " -> " + dependency.dst_lib)
コード例 #2
0
def write_lib_graph(data):
    log_block("writing library dependency graph")
    dependencies, ignore = build_lib_dependencies(data)
    with open('libraries.gv', 'w') as output:
        output.write("digraph G {\n")
        for src in dependencies.keys():
            for dst in dependencies[src]:
                line = ""
                if src in myConfig.dependencies and dst in myConfig.dependencies[src]:
                    line = src + " -> " + dst + ";\n"
                else:
                    line = src + " -> " + dst + " [color = red];\n"
                output.write(line)
        for src in myConfig.dependencies:
            for dst in myConfig.dependencies[src]:
                if src in dependencies and dst in dependencies[src]:
                    continue
                else:
                    line = src + " -> " + dst + " [color = blue];\n"
                    output.write(line)
        output.write("}\n")