Allow multiple patch directories per environment

This commit is contained in:
Thomas Basler 2024-01-07 00:47:05 +01:00
parent 2608080708
commit 6556268056
2 changed files with 270 additions and 264 deletions

View File

@ -9,7 +9,10 @@ import re
Import("env") Import("env")
def getPatchPath(env): def getPatchPath(env):
return os.path.join(env["PROJECT_DIR"], "patches", env.GetProjectOption('custom_patches')) patchList = []
for patch in env.GetProjectOption('custom_patches').split(","):
patchList.append(os.path.join(env["PROJECT_DIR"], "patches", patch))
return patchList
def is_tool(name): def is_tool(name):
"""Check whether `name` is on PATH and marked as executable.""" """Check whether `name` is on PATH and marked as executable."""
@ -44,7 +47,8 @@ def main():
print('Git not found. Will not apply custom patches!') print('Git not found. Will not apply custom patches!')
return return
directory = getPatchPath(env) directories = getPatchPath(env)
for directory in directories:
if (not os.path.isdir(directory)): if (not os.path.isdir(directory)):
print('Patch directory not found: ' + directory) print('Patch directory not found: ' + directory)
return return

View File

@ -59,6 +59,8 @@ board_build.embed_files =
webapp_dist/js/app.js.gz webapp_dist/js/app.js.gz
webapp_dist/site.webmanifest webapp_dist/site.webmanifest
custom_patches =
monitor_filters = esp32_exception_decoder, time, log2file, colorize monitor_filters = esp32_exception_decoder, time, log2file, colorize
monitor_speed = 115200 monitor_speed = 115200
upload_protocol = esptool upload_protocol = esptool
@ -75,13 +77,13 @@ build_flags = ${env.build_flags}
[env:generic_esp32c3] [env:generic_esp32c3]
board = esp32-c3-devkitc-02 board = esp32-c3-devkitc-02
custom_patches = esp32c3 custom_patches = ${env.custom_patches},esp32c3
build_flags = ${env.build_flags} build_flags = ${env.build_flags}
[env:generic_esp32c3_usb] [env:generic_esp32c3_usb]
board = esp32-c3-devkitc-02 board = esp32-c3-devkitc-02
custom_patches = esp32c3 custom_patches = ${env.custom_patches},esp32c3
build_flags = ${env.build_flags} build_flags = ${env.build_flags}
-DARDUINO_USB_MODE=1 -DARDUINO_USB_MODE=1
-DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_CDC_ON_BOOT=1