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

Function _parse_build_filename

ci/lint_cpp/test_unity_build.py:134–166  ·  view source on GitHub ↗

Parse a build filename into (mapped_directory, is_recursive). Args: filename: Build filename (e.g., "src.cpp", "fl.audio+.cpp", "platforms+.cpp") Returns: Tuple of (directory path relative to src/, is_recursive) Examples: "src.cpp" -> ("", False)

(filename: str)

Source from the content-addressed store, hash-verified

132
133
134def _parse_build_filename(filename: str) -> tuple[str, bool]:
135 """
136 Parse a build filename into (mapped_directory, is_recursive).
137
138 Args:
139 filename: Build filename (e.g., "src.cpp", "fl.audio+.cpp", "platforms+.cpp")
140
141 Returns:
142 Tuple of (directory path relative to src/, is_recursive)
143
144 Examples:
145 "src.cpp" -> ("", False) # maps to src/ root, flat
146 "fl.cpp" -> ("fl", False) # maps to src/fl/, flat
147 "fl.audio+.cpp" -> ("fl/audio", True)
148 "platforms+.cpp" -> ("platforms", True)
149 "third_party+.cpp" -> ("third_party", True)
150 """
151 # Strip .cpp suffix
152 stem = filename.removesuffix(".cpp")
153
154 # Check for recursive marker
155 is_recursive = stem.endswith("+")
156 if is_recursive:
157 stem = stem.removesuffix("+")
158
159 # Special case: "src" maps to root src/ directory (empty relative path)
160 if stem == "src":
161 return ("", is_recursive)
162
163 # Replace dots with slashes to get directory path
164 # Handle "third_party" which contains an underscore (not a dot)
165 dir_path = stem.replace(".", "/")
166 return (dir_path, is_recursive)
167
168
169def _get_independently_compiled_dirs(src_dir: Path) -> set[str]:

Callers 3

_check_build_file_namingFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected