MCPcopy
hub / github.com/pyodide/pyodide / main

Function main

tools/calculate_build_cache_key.py:23–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21
22
23def main():
24 import pathspec # pip install pathspec
25
26 root: Path = Path(__file__).parent.parent
27 targets: list[Path] = [
28 root / "Makefile",
29 root / "Makefile.envs",
30 root / "packages" / "Makefile",
31 root / "tools",
32 ]
33
34 ignore_pattern = get_ignore_pattern(root)
35 ignore_spec = pathspec.PathSpec.from_lines("gitwildmatch", ignore_pattern)
36
37 hash_candidates: list[Path] = []
38 for target in targets:
39 if target.is_file():
40 hash_candidates.append(target)
41 else:
42 hash_candidates.extend(list(target.glob("**/*")))
43
44 hash_candidates_filtered = sorted(
45 filter(
46 lambda file: file.is_file() and not ignore_spec.match_file(str(file)),
47 hash_candidates,
48 )
49 )
50
51 hashes = (hash_file(file) for file in hash_candidates_filtered)
52 print("".join(hashes))
53
54
55if __name__ == "__main__":

Callers 1

Calls 5

get_ignore_patternFunction · 0.85
hash_fileFunction · 0.85
extendMethod · 0.80
joinMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…