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.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 pioutil
  9. if pioutil.is_pio_build():
  10. import os,shutil,marlin
  11. from SCons.Script import DefaultEnvironment
  12. from platformio import util
  13. env = DefaultEnvironment()
  14. #
  15. # Get the platform name from the 'platform_packages' option,
  16. # or look it up by the platform.class.name.
  17. #
  18. platform = env.PioPlatform()
  19. from platformio.package.meta import PackageSpec
  20. platform_packages = env.GetProjectOption('platform_packages')
  21. if len(platform_packages) == 0:
  22. framewords = {
  23. "Ststm32Platform": "framework-arduinoststm32",
  24. "AtmelavrPlatform": "framework-arduino-avr"
  25. }
  26. platform_name = framewords[platform.__class__.__name__]
  27. else:
  28. platform_name = PackageSpec(platform_packages[0]).name
  29. 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", "biqu-bx-workaround", "main" ]:
  30. platform_name = "framework-arduinoststm32"
  31. FRAMEWORK_DIR = platform.get_package_dir(platform_name)
  32. assert os.path.isdir(FRAMEWORK_DIR)
  33. board = env.BoardConfig()
  34. #mcu_type = board.get("build.mcu")[:-2]
  35. variant = board.get("build.variant")
  36. #series = mcu_type[:7].upper() + "xx"
  37. # Prepare a new empty folder at the destination
  38. variant_dir = os.path.join(FRAMEWORK_DIR, "variants", variant)
  39. if os.path.isdir(variant_dir):
  40. shutil.rmtree(variant_dir)
  41. if not os.path.isdir(variant_dir):
  42. os.mkdir(variant_dir)
  43. # Source dir is a local variant sub-folder
  44. source_dir = os.path.join("buildroot/share/PlatformIO/variants", variant)
  45. assert os.path.isdir(source_dir)
  46. marlin.copytree(source_dir, variant_dir)