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.

generic_create_variant.py 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #
  2. # generic_create_variant.py
  3. #
  4. # Copy one of the variants from buildroot/platformio/variants into
  5. # the appropriate framework variants folder, so that its contents
  6. # will be picked up by PlatformIO just like any other variant.
  7. #
  8. import os,shutil,marlin
  9. from SCons.Script import DefaultEnvironment
  10. from platformio import util
  11. env = DefaultEnvironment()
  12. #
  13. # Get the platform name from the 'platform_packages' option,
  14. # or look it up by the platform.class.name.
  15. #
  16. platform = env.PioPlatform()
  17. from platformio.package.meta import PackageSpec
  18. platform_packages = env.GetProjectOption('platform_packages')
  19. if len(platform_packages) == 0:
  20. framewords = {
  21. "Ststm32Platform": "framework-arduinoststm32",
  22. "AtmelavrPlatform": "framework-arduino-avr"
  23. }
  24. platform_name = framewords[platform.__class__.__name__]
  25. else:
  26. platform_name = PackageSpec(platform_packages[0]).name
  27. if platform_name in [ "usb-host-msc", "usb-host-msc-cdc-msc", "usb-host-msc-cdc-msc-2", "usb-host-msc-cdc-msc-3", "tool-stm32duino" ]:
  28. platform_name = "framework-arduinoststm32"
  29. FRAMEWORK_DIR = platform.get_package_dir(platform_name)
  30. assert os.path.isdir(FRAMEWORK_DIR)
  31. board = env.BoardConfig()
  32. #mcu_type = board.get("build.mcu")[:-2]
  33. variant = board.get("build.variant")
  34. #series = mcu_type[:7].upper() + "xx"
  35. # Prepare a new empty folder at the destination
  36. variant_dir = os.path.join(FRAMEWORK_DIR, "variants", variant)
  37. if os.path.isdir(variant_dir):
  38. shutil.rmtree(variant_dir)
  39. if not os.path.isdir(variant_dir):
  40. os.mkdir(variant_dir)
  41. # Source dir is a local variant sub-folder
  42. source_dir = os.path.join("buildroot/share/PlatformIO/variants", variant)
  43. assert os.path.isdir(source_dir)
  44. marlin.copytree(source_dir, variant_dir)