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

Function _find_depfile_separator

ci/compile_pch.py:41–70  ·  view source on GitHub ↗

Find the index of the target:dependency separator colon in depfile content. On Windows, paths contain drive-letter colons (e.g. ``C:\\path``). A drive letter colon is a single alpha character immediately before the colon, at the start of a path token (position 0, or preceded by a non-a

(content: str)

Source from the content-addressed store, hash-verified

39
40
41def _find_depfile_separator(content: str) -> int:
42 """Find the index of the target:dependency separator colon in depfile content.
43
44 On Windows, paths contain drive-letter colons (e.g. ``C:\\path``). A drive
45 letter colon is a single alpha character immediately before the colon, at
46 the start of a path token (position 0, or preceded by a non-alphanumeric
47 such as a space). We skip those and return the first ``": "`` that is NOT
48 a drive-letter colon.
49
50 Returns the index of the ``':'`` character, or ``-1`` if not found.
51 """
52 idx = 0
53 while True:
54 space_idx = content.find(": ", idx)
55 if space_idx == -1:
56 return -1
57
58 # A Windows drive letter looks like X: where X is a single alpha
59 # character at the start of a token (pos 0 or preceded by whitespace /
60 # non-alphanumeric).
61 if space_idx > 0:
62 char_before = content[space_idx - 1]
63 if char_before.isalpha() and (
64 space_idx == 1 or not content[space_idx - 2].isalnum()
65 ):
66 # Looks like a drive letter — skip it.
67 idx = space_idx + 1
68 continue
69
70 return space_idx
71
72
73def fix_depfile(depfile_path: Path, pch_output_path: Path) -> None:

Callers 2

fix_depfileFunction · 0.85
parse_depfile_inputsFunction · 0.85

Calls 1

findMethod · 0.45

Tested by

no test coverage detected