Skip to content

Commit d911f7d

Browse files
committed
feat: add argparse to cmake_updater_hook
Mostly to benefit from the built-in "--help", as the script takes no actual argument.
1 parent 2c5f7ca commit d911f7d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

cmake/scripts/cmake_updater_hook.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,41 @@
66
Hint: it would be a good practice to run it before committing...
77
"""
88

9+
import argparse
910
import subprocess
1011
import pathlib
12+
import sys
13+
14+
parser = argparse.ArgumentParser(
15+
usage="updater hook for CMake files. Fully automatic, takes no argument."
16+
)
17+
shargs = parser.parse_args()
1118

1219
script_dir = pathlib.Path(__file__).parent # Arduino_Core_STM32/cmake/scripts
1320
base_dir = script_dir.parent.parent # Arduino_Core_STM32
1421
templates_dir = base_dir / "cmake" / "templates"
1522

1623
print("Updating core/arduino...")
1724
subprocess.run(
18-
("python3", script_dir / "cmake_core.py", base_dir / "cores" / "arduino"),
25+
(sys.executable, script_dir / "cmake_core.py", base_dir / "cores" / "arduino"),
1926
check=True,
2027
)
2128

2229
print("Updating libraries/...")
2330
subprocess.run(
24-
("python3", script_dir / "cmake_libs.py", "-L", base_dir / "libraries"),
31+
(sys.executable, script_dir / "cmake_libs.py", "-L", base_dir / "libraries"),
2532
check=True,
2633
)
2734

2835
print("Updating variants/...")
2936
subprocess.run(
30-
("python3", script_dir / "cmake_variant.py", base_dir / "variants"),
37+
(sys.executable, script_dir / "cmake_variant.py", base_dir / "variants"),
3138
check=True,
3239
)
3340
print("Updating board database...")
3441
subprocess.run(
3542
(
36-
"python3",
43+
sys.executable,
3744
script_dir / "update_boarddb.py",
3845
"-b",
3946
base_dir / "boards.txt",

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy