forked from atsamd-rs/atsamd
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-all.py
More file actions
executable file
·34 lines (24 loc) · 852 Bytes
/
build-all.py
File metadata and controls
executable file
·34 lines (24 loc) · 852 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
#!/usr/bin/env python3
import json
import shlex
import subprocess
from pathlib import PurePath
def main(clean=False):
with open("crates.json", "r") as f:
crates = json.load(f)
for (board, jobs) in crates["boards"].items():
print()
print("-" * 80)
print(f"Crate: {board}")
print(f"Command: {jobs['build']}\n")
command = shlex.split(jobs["build"])
crate_path = PurePath("boards", board)
if clean:
subprocess.check_call(shlex.split("cargo clean"), cwd=crate_path)
subprocess.check_call(command, cwd=crate_path)
if __name__ == "__main__":
import argparse;
parser = argparse.ArgumentParser()
parser.add_argument("--clean", action="store_true", help="clean the crate before building")
args = parser.parse_args()
main(clean=args.clean)