MCPcopy Create free account
hub / github.com/FastLED/FastLED / parse_depfile

Function parse_depfile

ci/wasm_build_library.py:111–148  ·  view source on GitHub ↗

Parse Makefile-style dependency file to extract header dependencies. Format: target: dep1 dep2 dep3 \ dep4 dep5 Returns: List of dependency paths (excluding target)

(depfile_path: Path)

Source from the content-addressed store, hash-verified

109
110
111def parse_depfile(depfile_path: Path) -> list[Path]:
112 """
113 Parse Makefile-style dependency file to extract header dependencies.
114
115 Format: target: dep1 dep2 dep3 \
116 dep4 dep5
117
118 Returns:
119 List of dependency paths (excluding target)
120 """
121 if not depfile_path.exists():
122 return []
123
124 try:
125 with open(depfile_path) as f:
126 content = f.read()
127
128 # Remove line continuations
129 content = content.replace("\\\n", " ").replace("\\\r\n", " ")
130
131 # Split on colon to separate target from dependencies
132 if ":" not in content:
133 return []
134
135 deps_part = content.split(":", 1)[1]
136
137 # Split on whitespace and filter out empty strings
138 deps = [d.strip() for d in deps_part.split() if d.strip()]
139
140 # Convert to Path objects
141 return [Path(d) for d in deps]
142
143 except KeyboardInterrupt as ki:
144 handle_keyboard_interrupt(ki)
145 raise
146 except Exception as e:
147 print(f"Warning: Could not parse dependency file {depfile_path}: {e}")
148 return []
149
150
151def get_latest_mtime(paths: list[Path]) -> float:

Callers 1

needs_rebuildFunction · 0.70

Calls 3

printFunction · 0.50
readMethod · 0.45

Tested by

no test coverage detected