-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Copy pathcmake_updater_hook.py
57 lines (49 loc) · 1.41 KB
/
cmake_updater_hook.py
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env python3
"""
This file centralizes all the operations needed to regenerate the CMakeLists.txt
scattered along this repo.
Hint: it would be a good practice to run it before committing...
"""
import argparse
import subprocess
from pathlib import Path
import sys
parser = argparse.ArgumentParser(
usage="updater hook for CMake files. Fully automatic, takes no argument."
)
shargs = parser.parse_args()
script_dir = Path(__file__).parent.resolve() # Arduino_Core_STM32/cmake/scripts
base_dir = script_dir.parent.parent # Arduino_Core_STM32
templates_dir = base_dir / "cmake" / "templates"
print("Updating core/arduino...")
subprocess.run(
(sys.executable, script_dir / "cmake_core.py", base_dir / "cores" / "arduino"),
check=True,
)
print("Updating libraries/...")
subprocess.run(
(sys.executable, script_dir / "cmake_libs.py", "-L", base_dir / "libraries"),
check=True,
)
print("Updating variants/...")
subprocess.run(
(sys.executable, script_dir / "cmake_variant.py", base_dir / "variants"),
check=True,
)
print("Updating board database...")
subprocess.run(
(
sys.executable,
script_dir / "update_boarddb.py",
"-b",
base_dir / "boards.txt",
"-p",
base_dir / "platform.txt",
"-t",
templates_dir / "boards_db.cmake",
"-o",
base_dir / "cmake" / "boards_db.cmake",
),
check=True,
)
print("All done !")