|
6 | 6 | Hint: it would be a good practice to run it before committing...
|
7 | 7 | """
|
8 | 8 |
|
| 9 | +importargparse |
9 | 10 | importsubprocess
|
10 | 11 | importpathlib
|
| 12 | +importsys |
| 13 | + |
| 14 | +parser=argparse.ArgumentParser( |
| 15 | +usage="updater hook for CMake files. Fully automatic, takes no argument." |
| 16 | +) |
| 17 | +shargs=parser.parse_args() |
11 | 18 |
|
12 | 19 | script_dir=pathlib.Path(__file__).parent# Arduino_Core_STM32/cmake/scripts
|
13 | 20 | base_dir=script_dir.parent.parent# Arduino_Core_STM32
|
14 | 21 | templates_dir=base_dir/"cmake"/"templates"
|
15 | 22 |
|
16 | 23 | print("Updating core/arduino...")
|
17 | 24 | 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"), |
19 | 26 | check=True,
|
20 | 27 | )
|
21 | 28 |
|
22 | 29 | print("Updating libraries/...")
|
23 | 30 | 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"), |
25 | 32 | check=True,
|
26 | 33 | )
|
27 | 34 |
|
28 | 35 | print("Updating variants/...")
|
29 | 36 | subprocess.run(
|
30 |
| - ("python3",script_dir/"cmake_variant.py",base_dir/"variants"), |
| 37 | + (sys.executable,script_dir/"cmake_variant.py",base_dir/"variants"), |
31 | 38 | check=True,
|
32 | 39 | )
|
33 | 40 | print("Updating board database...")
|
34 | 41 | subprocess.run(
|
35 | 42 | (
|
36 |
| -"python3", |
| 43 | +sys.executable, |
37 | 44 | script_dir/"update_boarddb.py",
|
38 | 45 | "-b",
|
39 | 46 | base_dir/"boards.txt",
|
|