()
| 21 | |
| 22 | |
| 23 | def 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 | |
| 55 | if __name__ == "__main__": |
no test coverage detected
searching dependent graphs…