🔨 Simplify generic variants, update DFU tool (#27502)

This commit is contained in:
Scott Lahteine 2024-11-02 18:42:20 -05:00 committed by GitHub
parent 7b104a108f
commit 08717d3f60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 110 additions and 100 deletions

View file

@ -40,26 +40,17 @@ if pioutil.is_pio_build():
FRAMEWORK_DIR = Path(platform.get_package_dir(platform_name))
assert FRAMEWORK_DIR.is_dir()
#
# Point variants_dir to our variant folder when board_build.variant
# is provided and the variant name begins with "marlin_".
#
board = env.BoardConfig()
#mcu_type = board.get("build.mcu")[:-2]
variant = board.get("build.variant")
#mcu_type = board.get("build.mcu")[:-2]
#series = mcu_type[:7].upper() + "xx"
# Only prepare a new variant if the PlatformIO configuration provides it (board_build.variant).
# This check is important to avoid deleting official board config variants.
# Make sure the local variant sub-folder exists
if marlin_variant_pattern.match(str(variant).lower()):
# Prepare a new empty folder at the destination
variant_dir = FRAMEWORK_DIR / "variants" / variant
if variant_dir.is_dir():
shutil.rmtree(variant_dir)
if not variant_dir.is_dir():
variant_dir.mkdir()
# Source dir is a local variant sub-folder
source_dir = Path("buildroot/share/PlatformIO/variants", variant)
assert source_dir.is_dir()
print("Copying variant " + str(variant) + " to framework directory...")
marlin.copytree(source_dir, variant_dir)
board.update("build.variants_dir", "buildroot/share/PlatformIO/variants");