forked from risc0/zirgen
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclang-format.py
More file actions
37 lines (29 loc) · 776 Bytes
/
clang-format.py
File metadata and controls
37 lines (29 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Copyright (c) 2023 RISC Zero, Inc.
# All rights reserved.
#!/usr/bin/env python
import os
import subprocess
import pathlib
import sys
EXTENSIONS = [
".cpp",
".h",
]
ROOT_DIRS = [
"risc0",
"zirgen",
]
def main():
clang_format = pathlib.Path(sys.prefix) / "bin" / "clang-format"
print(clang_format)
for root_dir in ROOT_DIRS:
root = pathlib.Path(os.getenv("BUILD_WORKSPACE_DIRECTORY")) / root_dir
for root, _, files in os.walk(root):
for file in files:
path = pathlib.Path(root) / file
if path.suffix in EXTENSIONS:
print(".", end="", flush=True)
subprocess.run([clang_format, "-i", path])
print()
if __name__ == "__main__":
main()