From 2b39e51a4009b8d1395d79cbd7c10dfb28b041d7 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 26 Nov 2024 21:11:03 -0600 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20Fix=20schema.py=20;=20Add=20buil?= =?UTF-8?q?d=5Fexample=20--index=3DN?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildroot/bin/build_example | 9 +++++++-- buildroot/share/PlatformIO/scripts/schema.py | 3 +-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/buildroot/bin/build_example b/buildroot/bin/build_example index 259fb46872..2d558310ad 100755 --- a/buildroot/bin/build_example +++ b/buildroot/bin/build_example @@ -4,6 +4,7 @@ # # build_example -b|--base= - Configurations root folder (e.g., ./.pio/build-BRANCH) # -c|--config= - Sub-path of the configs to build (within config/examples) +# [-n|--index=N] - Which environment to build, by index (Based on pins.h comments) # [-e|--export=N] - Use CONFIG_EXPORT N to export the config to the export location # [-a|--archive] - Archive the build (to the export location) # [-o|--output] - Redirect export / archiving to another location @@ -19,6 +20,7 @@ usage() { echo "Usage: build_example -b|--base= - Configurations root folder (e.g., ./.pio/build-BRANCH) -c|--config= - Sub-path of the configs to build (within config/examples) + [-n|--index=N] - Which environment to build, by index (Based on pins.h comments) [-e|--export=N] - Use CONFIG_EXPORT N to export the config to the export location [-a|--archive] - Archive the build (to the export location) [-o|--output] - Redirect export / archiving to another location @@ -50,12 +52,14 @@ REVEAL= EXPNUM= NOFAIL= OUTBASE= -while getopts 'ab:c:e:fhio:r-:' OFLAG; do +BUILDINDEX=1 +while getopts 'ab:c:e:fhin:o:r-:' OFLAG; do case "${OFLAG}" in a) ARCHIVE=1 ;; b) BASE="${OPTARG%/}" ;; c) CONFIG="${OPTARG%/}" ;; e) EXPNUM="$OPTARG" ;; + n) BUILDINDEX="$OPTARG" ;; o) OUTBASE="${OPTARG%/}" ;; h) EXIT_USAGE=1 ; break ;; f) NOFAIL=1 ;; @@ -66,6 +70,7 @@ while getopts 'ab:c:e:fhio:r-:' OFLAG; do allow) ALLOW=1 ;; base) BASE="${OVAL%/}" ;; config) CONFIG="${OVAL%/}" ;; + index) BUILDINDEX="$OVAL" ;; export) EXPNUM="$OVAL" ;; output) OUTBASE="${OVAL%/}" ;; help) EXIT_USAGE=1 ; break ;; @@ -174,7 +179,7 @@ fi set +e echo "Building example $CONFIG ..." -mftest -s -a -n1 ; ERR=$? +mftest -s -a -n$BUILDINDEX ; ERR=$? ((ERR)) && alrt "Failed ($ERR)" || annc "Success" diff --git a/buildroot/share/PlatformIO/scripts/schema.py b/buildroot/share/PlatformIO/scripts/schema.py index dedc8727bf..f522632bbb 100755 --- a/buildroot/share/PlatformIO/scripts/schema.py +++ b/buildroot/share/PlatformIO/scripts/schema.py @@ -173,8 +173,7 @@ def extract_files(filekey): comment_buff = [] if cline != '': # A (block or slash) comment was already added - if 'comment' in last_added_ref: - cfield = 'notes' + cfield = 'notes' if 'comment' in last_added_ref else 'comment' last_added_ref[cfield] = cline #