MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / build_graph

Function build_graph

scripts/collect-single-file-header.py:64–84  ·  view source on GitHub ↗
(graph: graphlib.TopologicalSorter, source_file: Path)

Source from the content-addressed store, hash-verified

62
63
64def build_graph(graph: graphlib.TopologicalSorter, source_file: Path) -> None:
65 assert source_file.is_absolute()
66 global processed_headers
67 if source_file in processed_headers:
68 return
69 processed_headers.add(source_file.resolve())
70
71 with source_file.open("r") as f:
72 for line in f.readlines():
73 if not line.startswith('#include "'):
74 continue
75 header_path = line.split('"')[1]
76 header_real_path = resolve_include(source_file, header_path)
77 if header_real_path is None:
78 logging.error(f"Could not find {header_path} included in {source_file}")
79 sys.exit(1)
80 logging.debug(
81 f"Resolved {header_path} in {source_file} to {header_real_path}"
82 )
83 graph.add(source_file, header_real_path)
84 build_graph(graph, header_real_path)
85
86
87def create_merged_header():

Callers 1

create_merged_headerFunction · 0.85

Calls 4

resolve_includeFunction · 0.85
addMethod · 0.80
openMethod · 0.80
splitMethod · 0.45

Tested by

no test coverage detected