My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

STM32F1_create_variant.py 1.0KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #
  2. # STM32F1_create_variant.py
  3. #
  4. import os,shutil
  5. from SCons.Script import DefaultEnvironment
  6. from platformio import util
  7. def copytree(src, dst, symlinks=False, ignore=None):
  8. for item in os.listdir(src):
  9. s = os.path.join(src, item)
  10. d = os.path.join(dst, item)
  11. if os.path.isdir(s):
  12. shutil.copytree(s, d, symlinks, ignore)
  13. else:
  14. shutil.copy2(s, d)
  15. env = DefaultEnvironment()
  16. platform = env.PioPlatform()
  17. board = env.BoardConfig()
  18. FRAMEWORK_DIR = platform.get_package_dir("framework-arduinoststm32-maple")
  19. assert os.path.isdir(FRAMEWORK_DIR)
  20. assert os.path.isdir("buildroot/share/PlatformIO/variants")
  21. variant = board.get("build.variant")
  22. variant_dir = os.path.join(FRAMEWORK_DIR, "STM32F1", "variants", variant)
  23. source_dir = os.path.join("buildroot/share/PlatformIO/variants", variant)
  24. assert os.path.isdir(source_dir)
  25. if os.path.isdir(variant_dir):
  26. shutil.rmtree(variant_dir)
  27. if not os.path.isdir(variant_dir):
  28. os.mkdir(variant_dir)
  29. copytree(source_dir, variant_dir)