mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-03-01 20:37:05 +00:00
🔨 Improve build script compatibility (#27549)
This commit is contained in:
parent
22182d9a98
commit
3591eb5d5d
4 changed files with 44 additions and 42 deletions
|
@ -2,21 +2,21 @@
|
|||
#
|
||||
# Usage:
|
||||
#
|
||||
# build_all_examples [-b|--branch=<branch>] - Branch to fetch from Configurations repo (import-2.1.x)
|
||||
# build_all_examples [-a|--archive] - Copy the binary to the export location
|
||||
# [-B|--base] - Base path of configurations, overriding -b
|
||||
# [-b|--branch=<branch>] - Branch to fetch from Configurations repo (import-2.1.x)
|
||||
# [-c|--continue] - Continue the paused build
|
||||
# [-p|--purge] - Purge the status file and start over
|
||||
# [-s|--skip] - Continue the paused build, skipping one
|
||||
# [-r|--resume=<path>] - Start at some config in the filesystem order
|
||||
# [-l|--limit=#] - Limit the number of builds in this run
|
||||
# [-d|--debug] - Print extra debug output (after)
|
||||
# [-n|--nobuild] - Don't actually build anything
|
||||
# [-d|-v|--debug] - Print extra debug output (after)
|
||||
# [-e|--export=N] - Set CONFIG_EXPORT and export to the export location
|
||||
# [-f|--nofail] - Don't stop on a failed build
|
||||
# [-e|--export=N] - Set CONFIG_EXPORT and export into each config folder
|
||||
# [-a|--archive] - Copy the binary to the export location
|
||||
# [-h|--help] - Print usage and exit
|
||||
# [-l|--limit=#] - Limit the number of builds in this run
|
||||
# [-n|--nobuild] - Don't actually build anything
|
||||
# [-o|--output] - Redirect export / archiving to another location
|
||||
# (By default export to origin config folders)
|
||||
# [-h|--help] - Print usage and exit
|
||||
# [-p|--purge] - Purge the status file and start over
|
||||
# [-r|--resume=<path>] - Start at some config in the filesystem order
|
||||
# [-s|--skip] - Continue the paused build, skipping one
|
||||
#
|
||||
|
||||
HERE=`dirname $0`
|
||||
|
@ -29,21 +29,21 @@ STAT_FILE=./.pio/.buildall
|
|||
|
||||
usage() { echo "Usage:
|
||||
|
||||
build_all_examples [-b|--branch=<branch>] - Branch to fetch from Configurations repo (import-2.1.x)
|
||||
build_all_examples [-a|--archive] - Copy the binary to the export location
|
||||
[-B|--base] - Base path of configurations, overriding -b
|
||||
[-b|--branch=<branch>] - Branch to fetch from Configurations repo (import-2.1.x)
|
||||
[-c|--continue] - Continue the paused build
|
||||
[-p|--purge] - Purge the status file and start over
|
||||
[-s|--skip] - Continue the paused build, skipping one
|
||||
[-r|--resume=<path>] - Start at some config in the filesystem order
|
||||
[-d|-v|--debug] - Print extra debug output (after)
|
||||
[-e|--export=N] - Set CONFIG_EXPORT and export to the export location
|
||||
[-a|--archive] - Copy the binary to the export location
|
||||
[-o|--output] - Redirect export / archiving to another location
|
||||
(By default export to origin config folders)
|
||||
[-d|--debug] - Print extra debug output (after)
|
||||
[-l|--limit=#] - Limit the number of builds in this run
|
||||
[-n|--nobuild] - Don't actually build anything
|
||||
[-f|--nofail] - Don't stop on a failed build
|
||||
[-h|--help] - Print usage and exit
|
||||
[-l|--limit=#] - Limit the number of builds in this run
|
||||
[-n|--nobuild] - Don't actually build anything
|
||||
[-o|--output] - Redirect export / archiving to another location
|
||||
(By default export to origin config folders)
|
||||
[-p|--purge] - Purge the status file and start over
|
||||
[-r|--resume=<path>] - Start at some config in the filesystem order
|
||||
[-s|--skip] - Continue the paused build, skipping one
|
||||
"
|
||||
}
|
||||
|
||||
|
@ -53,22 +53,22 @@ unset FIRST_CONF
|
|||
EXIT_USAGE=
|
||||
LIMIT=1000
|
||||
|
||||
while getopts 'aB:b:ce:fdhl:no:pr:sv-:' OFLAG; do
|
||||
while getopts 'aB:b:cde:fhl:no:pr:sv-:' OFLAG; do
|
||||
case "${OFLAG}" in
|
||||
a) ARCHIVE=1 ; bugout "Archiving" ;;
|
||||
B) CBASE=${OPTARG%/} ; bugout "Base: $CBASE" ;;
|
||||
b) BRANCH=$OPTARG ; bugout "Branch: $BRANCH" ;;
|
||||
f) NOFAIL=1 ; bugout "Continue on Fail" ;;
|
||||
r) ISRES=1 ; FIRST_CONF=$OPTARG ; bugout "Resume: $FIRST_CONF" ;;
|
||||
c) CONTINUE=1 ; bugout "Continue" ;;
|
||||
s) CONTSKIP=1 ; bugout "Continue, skipping" ;;
|
||||
d|v) DEBUG=1 ; bugout "Debug ON" ;;
|
||||
e) CEXPORT=$OPTARG ; bugout "Export $CEXPORT" ;;
|
||||
o) OUTBASE="${OPTARG%/}" ; bugout "Archive to $OUTBASE" ;;
|
||||
f) NOFAIL=1 ; bugout "Continue on Fail" ;;
|
||||
h) EXIT_USAGE=1 ; break ;;
|
||||
l) LIMIT=$OPTARG ; bugout "Limit to $LIMIT build(s)" ;;
|
||||
d|v) DEBUG=1 ; bugout "Debug ON" ;;
|
||||
n) DRYRUN=1 ; bugout "Dry Run" ;;
|
||||
o) OUTBASE="${OPTARG%/}" ; bugout "Archive to $OUTBASE" ;;
|
||||
p) PURGE=1 ; bugout "Purge stat file" ;;
|
||||
r) ISRES=1 ; FIRST_CONF=$OPTARG ; bugout "Resume: $FIRST_CONF" ;;
|
||||
s) CONTSKIP=1 ; bugout "Continue, skipping" ;;
|
||||
-) ONAM="${OPTARG%%=*}" ; OVAL="${OPTARG#*=}"
|
||||
case "$ONAM" in
|
||||
archive) ARCHIVE=1 ; bugout "Archiving" ;;
|
||||
|
|
|
@ -53,16 +53,17 @@ EXPNUM=
|
|||
NOFAIL=
|
||||
OUTBASE=
|
||||
BUILDINDEX=1
|
||||
while getopts 'ab:c:e:fhin:o:r-:' OFLAG; do
|
||||
|
||||
while getopts 'ab:c:e:fhn:o:r-:' OFLAG; do
|
||||
case "${OFLAG}" in
|
||||
a) ARCHIVE=1 ;;
|
||||
b) BASE="${OPTARG%/}" ;;
|
||||
c) CONFIG="${OPTARG%/}" ;;
|
||||
e) EXPNUM="$OPTARG" ;;
|
||||
f) NOFAIL=1 ;;
|
||||
h) EXIT_USAGE=1 ; break ;;
|
||||
n) BUILDINDEX="$OPTARG" ;;
|
||||
o) OUTBASE="${OPTARG%/}" ;;
|
||||
h) EXIT_USAGE=1 ; break ;;
|
||||
f) NOFAIL=1 ;;
|
||||
r) REVEAL=1 ;;
|
||||
-) ONAM="${OPTARG%%=*}" ; OVAL="${OPTARG#*=}"
|
||||
case "$ONAM" in
|
||||
|
|
|
@ -16,23 +16,24 @@ bugout() { ((DEBUG)) && echo -e "\033[0;32m$1\033[0m" ; }
|
|||
|
||||
usage() {
|
||||
echo "
|
||||
Usage: mftest [-t|--env=<env|index>] [-n|--num=<num>] [-m|--make] [-y|--build=<Y|n>]
|
||||
mftest [-a|--autobuild]
|
||||
Usage: mftest [-a|--autobuild]
|
||||
mftest [-r|--rebuild]
|
||||
mftest [-s|--silent]
|
||||
mftest [-t|--env=<env|index>] [-n|--num=<num>] [-m|--make] [-y|--build=<Y|n>]
|
||||
mftest [-u|--autoupload] [-n|--num=<num>]
|
||||
|
||||
OPTIONS
|
||||
-t --env The environment to apply / run, or the menu index number.
|
||||
-n --num The index of the test to run. (In file order.)
|
||||
-m --make Use the make / Docker method for the build.
|
||||
-y --build Skip 'Do you want to build this test?' and assume YES.
|
||||
-h --help Print this help.
|
||||
-a --autobuild PIO Build using the MOTHERBOARD environment.
|
||||
-d --default Restore to defaults before applying configs.
|
||||
-h --help Print this help.
|
||||
-m --make Use the make / Docker method for the build.
|
||||
-n --num The index of the test to run. (In file order.)
|
||||
-r --rebuild Rebuild previous PIO Build.
|
||||
-s --silent Silence build output from PlatformIO.
|
||||
-t --env The environment to apply / run, or the menu index number.
|
||||
-u --autoupload PIO Upload using the MOTHERBOARD environment.
|
||||
-v --verbose Extra output for debugging.
|
||||
-s --silent Silence build output from PlatformIO.
|
||||
-d --default Restore to defaults before applying configs.
|
||||
-y --build Skip 'Do you want to build this test?' and assume YES.
|
||||
|
||||
env shortcuts: tree due esp lin lp8|lpc8 lp9|lpc9 m128 m256|mega stm|f1 f4 f7 s6 teensy|t31|t32 t35|t36 t40|t41
|
||||
"
|
||||
|
@ -56,7 +57,7 @@ TESTENV='-'
|
|||
CHOICE=0
|
||||
DEBUG=0
|
||||
|
||||
while getopts 'abdhmrsuvyn:t:-:' OFLAG; do
|
||||
while getopts 'adhmn:rst:uvy-:' OFLAG; do
|
||||
case "${OFLAG}" in
|
||||
a) AUTO_BUILD=1 ; bugout "Auto-Build target..." ;;
|
||||
d) DL_DEFAULTS=1 ; bugout "Restore to defaults..." ;;
|
||||
|
|
|
@ -126,7 +126,7 @@ def extract_files(filekey):
|
|||
sid = 0
|
||||
# Loop through files and parse them line by line
|
||||
for fn, fk in filekey.items():
|
||||
with Path("Marlin", fn).open() as fileobj:
|
||||
with Path("Marlin", fn).open(encoding='utf-8') as fileobj:
|
||||
section = 'none' # Current Settings section
|
||||
line_number = 0 # Counter for the line number of the file
|
||||
conditions = [] # Create a condition stack for the current file
|
||||
|
@ -428,12 +428,12 @@ def extract():
|
|||
return extract_files({ 'Configuration.h':'basic', 'Configuration_adv.h':'advanced' })
|
||||
|
||||
def dump_json(schema:dict, jpath:Path):
|
||||
with jpath.open('w') as jfile:
|
||||
with jpath.open('w', encoding='utf-8') as jfile:
|
||||
json.dump(schema, jfile, ensure_ascii=False, indent=2)
|
||||
|
||||
def dump_yaml(schema:dict, ypath:Path):
|
||||
import yaml
|
||||
with ypath.open('w') as yfile:
|
||||
with ypath.open('w', encoding='utf-8') as yfile:
|
||||
yaml.dump(schema, yfile, default_flow_style=False, width=120, indent=2)
|
||||
|
||||
def main():
|
||||
|
|
Loading…
Reference in a new issue