restore_configs 779 B

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env python3
  2. import os, sys, subprocess
  3. files_to_remove = [
  4. "Marlin/_Bootscreen.h",
  5. "Marlin/_Statusscreen.h",
  6. "marlin_config.json",
  7. ".pio/build/mc.zip"
  8. ]
  9. for file in files_to_remove:
  10. if os.path.exists(file):
  11. os.remove(file)
  12. def use_example_configs():
  13. try:
  14. subprocess.run(['use_example_configs'], check=True)
  15. except FileNotFoundError:
  16. print("use_example_configs not found, skipping.")
  17. pass
  18. if len(sys.argv) > 1 and sys.argv[1] in ['-d', '--default']:
  19. use_example_configs()
  20. else:
  21. files_to_checkout = [
  22. "Marlin/Configuration.h",
  23. "Marlin/Configuration_adv.h",
  24. "Marlin/config.ini",
  25. "Marlin/src/pins/*/pins_*.h"
  26. ]
  27. for file in files_to_checkout:
  28. subprocess.run(["git", "checkout", file], stderr=subprocess.DEVNULL)