🔨 Fix schema.py ; Add build_example --index=N

This commit is contained in:
Scott Lahteine 2024-11-26 21:11:03 -06:00
parent 37f490fdd0
commit 2b39e51a40
2 changed files with 8 additions and 4 deletions

View file

@ -4,6 +4,7 @@
# #
# build_example -b|--base=<path> - Configurations root folder (e.g., ./.pio/build-BRANCH) # build_example -b|--base=<path> - Configurations root folder (e.g., ./.pio/build-BRANCH)
# -c|--config=<rel> - Sub-path of the configs to build (within config/examples) # -c|--config=<rel> - 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 # [-e|--export=N] - Use CONFIG_EXPORT N to export the config to the export location
# [-a|--archive] - Archive the build (to the export location) # [-a|--archive] - Archive the build (to the export location)
# [-o|--output] - Redirect export / archiving to another location # [-o|--output] - Redirect export / archiving to another location
@ -19,6 +20,7 @@ usage() { echo "Usage:
build_example -b|--base=<path> - Configurations root folder (e.g., ./.pio/build-BRANCH) build_example -b|--base=<path> - Configurations root folder (e.g., ./.pio/build-BRANCH)
-c|--config=<rel> - Sub-path of the configs to build (within config/examples) -c|--config=<rel> - 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 [-e|--export=N] - Use CONFIG_EXPORT N to export the config to the export location
[-a|--archive] - Archive the build (to the export location) [-a|--archive] - Archive the build (to the export location)
[-o|--output] - Redirect export / archiving to another location [-o|--output] - Redirect export / archiving to another location
@ -50,12 +52,14 @@ REVEAL=
EXPNUM= EXPNUM=
NOFAIL= NOFAIL=
OUTBASE= 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 case "${OFLAG}" in
a) ARCHIVE=1 ;; a) ARCHIVE=1 ;;
b) BASE="${OPTARG%/}" ;; b) BASE="${OPTARG%/}" ;;
c) CONFIG="${OPTARG%/}" ;; c) CONFIG="${OPTARG%/}" ;;
e) EXPNUM="$OPTARG" ;; e) EXPNUM="$OPTARG" ;;
n) BUILDINDEX="$OPTARG" ;;
o) OUTBASE="${OPTARG%/}" ;; o) OUTBASE="${OPTARG%/}" ;;
h) EXIT_USAGE=1 ; break ;; h) EXIT_USAGE=1 ; break ;;
f) NOFAIL=1 ;; f) NOFAIL=1 ;;
@ -66,6 +70,7 @@ while getopts 'ab:c:e:fhio:r-:' OFLAG; do
allow) ALLOW=1 ;; allow) ALLOW=1 ;;
base) BASE="${OVAL%/}" ;; base) BASE="${OVAL%/}" ;;
config) CONFIG="${OVAL%/}" ;; config) CONFIG="${OVAL%/}" ;;
index) BUILDINDEX="$OVAL" ;;
export) EXPNUM="$OVAL" ;; export) EXPNUM="$OVAL" ;;
output) OUTBASE="${OVAL%/}" ;; output) OUTBASE="${OVAL%/}" ;;
help) EXIT_USAGE=1 ; break ;; help) EXIT_USAGE=1 ; break ;;
@ -174,7 +179,7 @@ fi
set +e set +e
echo "Building example $CONFIG ..." echo "Building example $CONFIG ..."
mftest -s -a -n1 ; ERR=$? mftest -s -a -n$BUILDINDEX ; ERR=$?
((ERR)) && alrt "Failed ($ERR)" || annc "Success" ((ERR)) && alrt "Failed ($ERR)" || annc "Success"

View file

@ -173,8 +173,7 @@ def extract_files(filekey):
comment_buff = [] comment_buff = []
if cline != '': if cline != '':
# A (block or slash) comment was already added # A (block or slash) comment was already added
if 'comment' in last_added_ref: cfield = 'notes' if 'comment' in last_added_ref else 'comment'
cfield = 'notes'
last_added_ref[cfield] = cline last_added_ref[cfield] = cline
# #