def process(index, graphs, trace=False): def output(s): if not trace: io.write(s) order = FileTypes.get_filetypes_by_build_target() for filetype in order: items = index.get(filetype, []) items = util.isort(items) if items: output('%s:\n' % filetype.name) for item in items: line = '- %s\n' % item output(line) if trace: graph_fp = trace_file(item, filetype) graph = DelphiGraph.from_file(graph_fp) graphs[item] = graph filter_index_by_graph(index, graph, excludes=[FileTypes.DelphiProjectGroup, FileTypes.DelphiProject, FileTypes.Program, FileTypes.Library, FileTypes.Package])
def get_explore_report(index, graphs): s = 'Graphs:\n' order = FileTypes.get_filetypes_by_build_target() for filetype in order: items = index.get(filetype, []) items = util.isort(items) for item in items: dg = graphs.get(item) filter_index_by_graph(index, dg, excludes=[]) if dg: df = dg.rootnode def set_path(node): node.path = io.relpath(os.path.join(dg.abspath, node.path), relative_to=os.getcwd()) return True set_path(df) df.filter_nodes(set_path) df.filter_nodes(lambda n: n.filetype in order) s += '\n'.join(collect_nodes(df)) + '\n' t = '' order = FileTypes.get_filetypes_by_category(Categories.Source) for filetype in order: items = index.get(filetype, []) items = util.isort(items) if items: t += '= %s =\n' % filetype.name for item in items: t += '- %s\n' % item if t: s += '\nLoose files:\n' s += t return s