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

Function compute_source_tree_hash

ci/iwyu_cache.py:37–57  ·  view source on GitHub ↗

Compute a hash over all header files' paths and mtimes. This acts as a "generation" marker: when any header changes, the hash changes, invalidating all cached IWYU results. Correctly handles transitive dependency changes. Args: header_files: All headers that IWYU will scan.

(header_files: list[Path])

Source from the content-addressed store, hash-verified

35
36
37def compute_source_tree_hash(header_files: list[Path]) -> str:
38 """Compute a hash over all header files' paths and mtimes.
39
40 This acts as a "generation" marker: when any header changes,
41 the hash changes, invalidating all cached IWYU results.
42 Correctly handles transitive dependency changes.
43
44 Args:
45 header_files: All headers that IWYU will scan.
46
47 Returns:
48 Hex digest string.
49 """
50 hasher = hashlib.sha256()
51 for f in sorted(header_files, key=str):
52 hasher.update(str(f).encode("utf-8"))
53 try:
54 hasher.update(str(os.path.getmtime(str(f))).encode("utf-8"))
55 except OSError:
56 hasher.update(b"MISSING")
57 return hasher.hexdigest()
58
59
60def _compute_file_hash(

Callers 1

scan_fl_headersFunction · 0.90

Calls 1

updateMethod · 0.45

Tested by

no test coverage detected