STM32F1_create_variant.py 774 B

12345678910111213141516171819202122232425262728293031
  1. #
  2. # STM32F1_create_variant.py
  3. #
  4. import pioutil
  5. if pioutil.is_pio_build():
  6. import shutil,marlin
  7. from pathlib import Path
  8. Import("env")
  9. platform = env.PioPlatform()
  10. board = env.BoardConfig()
  11. FRAMEWORK_DIR = Path(platform.get_package_dir("framework-arduinoststm32-maple"))
  12. assert FRAMEWORK_DIR.is_dir()
  13. source_root = Path("buildroot/share/PlatformIO/variants")
  14. assert source_root.is_dir()
  15. variant = board.get("build.variant")
  16. variant_dir = FRAMEWORK_DIR / "STM32F1/variants" / variant
  17. source_dir = source_root / variant
  18. assert source_dir.is_dir()
  19. if variant_dir.is_dir():
  20. shutil.rmtree(variant_dir)
  21. if not variant_dir.is_dir():
  22. variant_dir.mkdir()
  23. marlin.copytree(source_dir, variant_dir)