Skip to content

Commit dc7d67b

Browse files
committed
convert restore_configs too
1 parent baace46 commit dc7d67b

File tree

1 file changed

+33
-12
lines changed

1 file changed

+33
-12
lines changed

buildroot/bin/restore_configs

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,33 @@
1-
#!/usr/bin/env bash
2-
3-
rm -f Marlin/_Bootscreen.h Marlin/_Statusscreen.h marlin_config.json .pio/build/mc.zip
4-
5-
if [[ $1 == '-d' || $1 == '--default' ]]; then
6-
use_example_configs
7-
else
8-
git checkout Marlin/Configuration.h 2>/dev/null
9-
git checkout Marlin/Configuration_adv.h 2>/dev/null
10-
git checkout Marlin/config.ini 2>/dev/null
11-
git checkout Marlin/src/pins/*/pins_*.h 2>/dev/null
12-
fi
1+
#!/usr/bin/env python3
2+
3+
import os, sys, subprocess
4+
5+
files_to_remove = [
6+
"Marlin/_Bootscreen.h",
7+
"Marlin/_Statusscreen.h",
8+
"marlin_config.json",
9+
".pio/build/mc.zip"
10+
]
11+
12+
for file in files_to_remove:
13+
if os.path.exists(file):
14+
os.remove(file)
15+
16+
def use_example_configs():
17+
try:
18+
subprocess.run(['use_example_configs'], check=True)
19+
except FileNotFoundError:
20+
print("use_example_configs not found, skipping.")
21+
pass
22+
23+
if len(sys.argv) > 1 and sys.argv[1] in ['-d', '--default']:
24+
use_example_configs()
25+
else:
26+
files_to_checkout = [
27+
"Marlin/Configuration.h",
28+
"Marlin/Configuration_adv.h",
29+
"Marlin/config.ini",
30+
"Marlin/src/pins/*/pins_*.h"
31+
]
32+
for file in files_to_checkout:
33+
subprocess.run(["git", "checkout", file], stderr=subprocess.DEVNULL)

0 commit comments

Comments
 (0)