-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔨 Migrate use_example_configs to Python (#27632)
- Loading branch information
Showing
2 changed files
with
106 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,33 @@ | ||
#!/usr/bin/env bash | ||
|
||
rm -f Marlin/_Bootscreen.h Marlin/_Statusscreen.h marlin_config.json .pio/build/mc.zip | ||
|
||
if [[ $1 == '-d' || $1 == '--default' ]]; then | ||
use_example_configs | ||
else | ||
git checkout Marlin/Configuration.h 2>/dev/null | ||
git checkout Marlin/Configuration_adv.h 2>/dev/null | ||
git checkout Marlin/config.ini 2>/dev/null | ||
git checkout Marlin/src/pins/*/pins_*.h 2>/dev/null | ||
fi | ||
#!/usr/bin/env python3 | ||
|
||
import os, sys, subprocess | ||
|
||
files_to_remove = [ | ||
"Marlin/_Bootscreen.h", | ||
"Marlin/_Statusscreen.h", | ||
"marlin_config.json", | ||
".pio/build/mc.zip" | ||
] | ||
|
||
for file in files_to_remove: | ||
if os.path.exists(file): | ||
os.remove(file) | ||
|
||
def use_example_configs(): | ||
try: | ||
subprocess.run(['use_example_configs'], check=True) | ||
except FileNotFoundError: | ||
print("use_example_configs not found, skipping.") | ||
pass | ||
|
||
if len(sys.argv) > 1 and sys.argv[1] in ['-d', '--default']: | ||
use_example_configs() | ||
else: | ||
files_to_checkout = [ | ||
"Marlin/Configuration.h", | ||
"Marlin/Configuration_adv.h", | ||
"Marlin/config.ini", | ||
"Marlin/src/pins/*/pins_*.h" | ||
] | ||
for file in files_to_checkout: | ||
subprocess.run(["git", "checkout", file], stderr=subprocess.DEVNULL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters