treewide: Disable automatic argparse argument shortening

Disables allowing the python argparse library from automatically
shortening command line arguments, this prevents issues whereby
a new command is added and code that wrongly uses the shortened
command of an existing argument which is the same as the new
command being added will silently change script behaviour.

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
This commit is contained in:
Jamie McCrae 2023-01-04 16:08:36 +00:00 committed by Stephanos Ioannidis
parent d428c8c836
commit ec7044437e
85 changed files with 104 additions and 97 deletions

View file

@ -611,7 +611,7 @@ execute_process(
${ZEPHYR_BASE}/scripts/build/subfolder_list.py ${ZEPHYR_BASE}/scripts/build/subfolder_list.py
--directory ${ZEPHYR_BASE}/include # Walk this directory --directory ${ZEPHYR_BASE}/include # Walk this directory
--out-file ${syscalls_subdirs_txt} # Write file with discovered folder --out-file ${syscalls_subdirs_txt} # Write file with discovered folder
--trigger ${syscalls_subdirs_trigger} # Trigger file that is used for json generation --trigger-file ${syscalls_subdirs_trigger} # Trigger file that is used for json generation
${syscalls_links} # If defined, create symlinks for dependencies ${syscalls_links} # If defined, create symlinks for dependencies
) )
file(STRINGS ${syscalls_subdirs_txt} PARSE_SYSCALLS_PATHS_DEPENDS ENCODING UTF-8) file(STRINGS ${syscalls_subdirs_txt} PARSE_SYSCALLS_PATHS_DEPENDS ENCODING UTF-8)
@ -644,7 +644,7 @@ else()
${ZEPHYR_BASE}/scripts/build/subfolder_list.py ${ZEPHYR_BASE}/scripts/build/subfolder_list.py
--directory ${ZEPHYR_BASE}/include # Walk this directory --directory ${ZEPHYR_BASE}/include # Walk this directory
--out-file ${syscalls_subdirs_txt} # Write file with discovered folder --out-file ${syscalls_subdirs_txt} # Write file with discovered folder
--trigger ${syscalls_subdirs_trigger} # Trigger file that is used for json generation --trigger-file ${syscalls_subdirs_trigger} # Trigger file that is used for json generation
${syscalls_links} # If defined, create symlinks for dependencies ${syscalls_links} # If defined, create symlinks for dependencies
DEPENDS ${PARSE_SYSCALLS_PATHS_DEPENDS} DEPENDS ${PARSE_SYSCALLS_PATHS_DEPENDS}
) )
@ -740,7 +740,7 @@ add_custom_command(OUTPUT include/generated/syscall_dispatch.c ${syscall_list_h}
) )
# This is passed into all calls to the gen_kobject_list.py script. # This is passed into all calls to the gen_kobject_list.py script.
set(gen_kobject_list_include_args --include ${struct_tags_json}) set(gen_kobject_list_include_args --include-subsystem-list ${struct_tags_json})
set(DRV_VALIDATION ${PROJECT_BINARY_DIR}/include/generated/driver-validation.h) set(DRV_VALIDATION ${PROJECT_BINARY_DIR}/include/generated/driver-validation.h)
add_custom_command( add_custom_command(

View file

@ -158,7 +158,7 @@ def parse_args():
global args global args
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-k", "--kernel", required=True, parser.add_argument("-k", "--kernel", required=True,
help="Zephyr kernel image") help="Zephyr kernel image")

View file

@ -251,7 +251,7 @@ def parse_args():
global args global args
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-m", "--vector-map", required=True, parser.add_argument("-m", "--vector-map", required=True,
help="Output file mapping IRQ lines to IDT vectors") help="Output file mapping IRQ lines to IDT vectors")

View file

@ -599,7 +599,7 @@ def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-k", "--kernel", required=True, parser.add_argument("-k", "--kernel", required=True,
help="path to prebuilt kernel ELF binary") help="path to prebuilt kernel ELF binary")

View file

@ -142,7 +142,7 @@ def build_elf(elf_file, include_dirs):
def parse_args(): def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-c", "--compiler", required=True, help="Compiler to be used") parser.add_argument("-c", "--compiler", required=True, help="Compiler to be used")
parser.add_argument("-o", "--objcopy", required=True, help="objcopy to be used") parser.add_argument("-o", "--objcopy", required=True, help="objcopy to be used")

View file

@ -172,7 +172,7 @@ def main():
def parse_args(): def parse_args():
# Parse command line arguments from sys.argv. # Parse command line arguments from sys.argv.
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument('-v', '--verbose', default=0, action='count', parser.add_argument('-v', '--verbose', default=0, action='count',
help='increase verbosity; may be given multiple times') help='increase verbosity; may be given multiple times')
parser.add_argument('--vendor-prefixes', required=True, parser.add_argument('--vendor-prefixes', required=True,

View file

@ -176,7 +176,7 @@ def train_net(
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument("--model", "-m") parser.add_argument("--model", "-m")
parser.add_argument("--person", "-p") parser.add_argument("--person", "-p")
args = parser.parse_args() args = parser.parse_args()

View file

@ -12,7 +12,7 @@ def parse_args():
global args global args
parser = argparse.ArgumentParser(description=__doc__, parser = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument( parser.add_argument(
"-d", "--device", required=True, "-d", "--device", required=True,

View file

@ -14,7 +14,7 @@ j = """
]""" ]"""
channels = json.loads(j) channels = json.loads(j)
parser = argparse.ArgumentParser(description='Read zbus events via serial.') parser = argparse.ArgumentParser(description='Read zbus events via serial.', allow_abbrev=False)
parser.add_argument("port", type=str, help='The tty or COM port to be used') parser.add_argument("port", type=str, help='The tty or COM port to be used')
args = parser.parse_args() args = parser.parse_args()

View file

@ -14,7 +14,7 @@ j = """
] ]
""" """
parser = argparse.ArgumentParser(description='Read zbus events via serial.') parser = argparse.ArgumentParser(description='Read zbus events via serial.', allow_abbrev=False)
parser.add_argument("port", type=str, help='The tty or COM port to be used') parser.add_argument("port", type=str, help='The tty or COM port to be used')
args = parser.parse_args() args = parser.parse_args()

View file

@ -20,7 +20,7 @@ def dump_header(infile, image, header):
inhex.tobinfile(header, start=start, end=end-1) inhex.tobinfile(header, start=start, end=end-1)
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument('input') parser.add_argument('input')
parser.add_argument('image') parser.add_argument('image')
parser.add_argument('header') parser.add_argument('header')

View file

@ -23,7 +23,7 @@ def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-f", "--file", required=True, help="Input file") parser.add_argument("-f", "--file", required=True, help="Input file")
parser.add_argument("-g", "--gzip", action="store_true", parser.add_argument("-g", "--gzip", action="store_true",

View file

@ -232,7 +232,7 @@ def parse_args():
global args global args
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-d", "--directory", required=False, default=None, parser.add_argument("-d", "--directory", required=False, default=None,
help="Root build directory") help="Root build directory")
parser.add_argument("-e", "--elf", required=False, default=None, parser.add_argument("-e", "--elf", required=False, default=None,

View file

@ -194,7 +194,7 @@ def parse_args():
global args global args
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Character Frame Buffer (CFB) font header file generator", description="Character Frame Buffer (CFB) font header file generator",
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument( parser.add_argument(
"-z", "--zephyr-base", "-z", "--zephyr-base",

View file

@ -43,7 +43,7 @@ def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-k", "--kernel", required=True, parser.add_argument("-k", "--kernel", required=True,
help="Input zephyr ELF binary") help="Input zephyr ELF binary")

View file

@ -66,7 +66,7 @@ def main():
parser = argparse.ArgumentParser(description=''' parser = argparse.ArgumentParser(description='''
Process ELF file and extract image information. Process ELF file and extract image information.
Create header file with extracted image information which can be included Create header file with extracted image information which can be included
in other build systems.''') in other build systems.''', allow_abbrev=False)
parser.add_argument('--header-file', required=True, parser.add_argument('--header-file', required=True,
help="""Header file to write with image data.""") help="""Header file to write with image data.""")

View file

@ -105,7 +105,7 @@ def parse_args():
global args global args
parser = argparse.ArgumentParser(description=__doc__, parser = argparse.ArgumentParser(description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-e", "--big-endian", action="store_true", parser.add_argument("-e", "--big-endian", action="store_true",
help="Target encodes data in big-endian format (little endian is " help="Target encodes data in big-endian format (little endian is "

View file

@ -981,7 +981,7 @@ def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-k", "--kernel", required=False, parser.add_argument("-k", "--kernel", required=False,
help="Input zephyr ELF binary") help="Input zephyr ELF binary")

View file

@ -108,7 +108,7 @@ def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("--object", required=True, parser.add_argument("--object", required=True,
help="Points to kobject_prebuilt_hash.c.obj") help="Points to kobject_prebuilt_hash.c.obj")

View file

@ -62,7 +62,7 @@ def gen_offset_header(input_name, input_file, output_file):
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument( parser.add_argument(
"-i", "-i",

View file

@ -407,7 +407,7 @@ def parse_args():
global args global args
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-d", "--directory", required=True, parser.add_argument("-d", "--directory", required=True,
help="obj file's directory") help="obj file's directory")
parser.add_argument("-i", "--input_rel_dict", required=True, parser.add_argument("-i", "--input_rel_dict", required=True,

View file

@ -79,7 +79,7 @@ def gen_strerror_table(input, output):
def parse_args(): def parse_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument( parser.add_argument(
'-i', '-i',
'--input', '--input',

View file

@ -387,7 +387,7 @@ def parse_args():
global args global args
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-i", "--json-file", required=True, parser.add_argument("-i", "--json-file", required=True,
help="Read syscall information from json file") help="Read syscall information from json file")

View file

@ -35,7 +35,7 @@ def merge_hex_files(output, input_hex_files, overlap):
def parse_args(): def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Merge hex files.", description="Merge hex files.",
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-o", "--output", required=False, default="merged.hex", parser.add_argument("-o", "--output", required=False, default="merged.hex",
type=argparse.FileType('w', encoding='UTF-8'), type=argparse.FileType('w', encoding='UTF-8'),
help="Output file name.") help="Output file name.")

View file

@ -110,7 +110,7 @@ def parse_args():
global args global args
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-i", "--include", required=True, action='append', parser.add_argument("-i", "--include", required=True, action='append',
help='''include directories recursively scanned help='''include directories recursively scanned

View file

@ -134,7 +134,8 @@ def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter,
allow_abbrev=False)
parser.add_argument("-i", "--input", required=True, parser.add_argument("-i", "--input", required=True,
help="Input C file from gperf") help="Input C file from gperf")

View file

@ -18,7 +18,8 @@ def parse_args():
"""Parse command line arguments and options""" """Parse command line arguments and options"""
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter,
allow_abbrev=False)
parser.add_argument('-d', '--directory', required=True, parser.add_argument('-d', '--directory', required=True,
help='Directory to walk for sub-directory discovery') help='Directory to walk for sub-directory discovery')

View file

@ -247,7 +247,8 @@ def main():
def error(msg): def error(msg):
print(msg) print(msg)
sys.exit(1) sys.exit(1)
parser = argparse.ArgumentParser(description='Convert to UF2 or flash directly.') parser = argparse.ArgumentParser(description='Convert to UF2 or flash directly.',
allow_abbrev=False)
parser.add_argument('input', metavar='INPUT', type=str, nargs='?', parser.add_argument('input', metavar='INPUT', type=str, nargs='?',
help='input file (HEX, BIN or UF2)') help='input file (HEX, BIN or UF2)')
parser.add_argument('-b' , '--base', dest='base', type=str, parser.add_argument('-b' , '--base', dest='base', type=str,

View file

@ -327,7 +327,7 @@ class KconfigCheck(ComplianceTest):
"gen_driver_kconfig_dts.py") "gen_driver_kconfig_dts.py")
binding_path = os.path.join(ZEPHYR_BASE, "dts", "bindings") binding_path = os.path.join(ZEPHYR_BASE, "dts", "bindings")
cmd = [sys.executable, zephyr_drv_kconfig_path, cmd = [sys.executable, zephyr_drv_kconfig_path,
'--kconfig-out', kconfig_dts_file, '--bindings', binding_path] '--kconfig-out', kconfig_dts_file, '--bindings-dirs', binding_path]
try: try:
subprocess.run(cmd, check=True, stdout=subprocess.PIPE, subprocess.run(cmd, check=True, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT) stderr=subprocess.STDOUT)
@ -1077,7 +1077,7 @@ def parse_args():
default_range = 'HEAD~1..HEAD' default_range = 'HEAD~1..HEAD'
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Check for coding style and documentation warnings.") description="Check for coding style and documentation warnings.", allow_abbrev=False)
parser.add_argument('-c', '--commits', default=default_range, parser.add_argument('-c', '--commits', default=default_range,
help=f'''Commit range in the form: a..[b], default is help=f'''Commit range in the form: a..[b], default is
{default_range}''') {default_range}''')

View file

@ -38,7 +38,7 @@ def parse_coccinelle(contents: str, violations: dict):
def parse_args(): def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Check if change requires full twister") description="Check if change requires full twister", allow_abbrev=False)
parser.add_argument('-c', '--commits', default=None, parser.add_argument('-c', '--commits', default=None,
help="Commit range in the form: a..b") help="Commit range in the form: a..b")
parser.add_argument("-o", "--output", required=False, parser.add_argument("-o", "--output", required=False,

View file

@ -293,7 +293,8 @@ class Filters:
def parse_args(): def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Generate twister argument files based on modified file") description="Generate twister argument files based on modified file",
allow_abbrev=False)
parser.add_argument('-c', '--commits', default=None, parser.add_argument('-c', '--commits', default=None,
help="Commit range in the form: a..b") help="Commit range in the form: a..b")
parser.add_argument('-m', '--modified-files', default=None, parser.add_argument('-m', '--modified-files', default=None,

View file

@ -46,7 +46,7 @@ def main():
def parse_args(): def parse_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument('-u', '--user', help='username') parser.add_argument('-u', '--user', help='username')
parser.add_argument('-p', '--password', help='password') parser.add_argument('-p', '--password', help='password')
parser.add_argument('-i', '--index', help='index to push to.', required=True) parser.add_argument('-i', '--index', help='index to push to.', required=True)

View file

@ -25,7 +25,7 @@ VERSIONS_FILE = "versions.json"
def parse_args(): def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Manage versions to be tested.") description="Manage versions to be tested.", allow_abbrev=False)
parser.add_argument('-l', '--list', action="store_true", parser.add_argument('-l', '--list', action="store_true",
help="List all published versions") help="List all published versions")
parser.add_argument('-u', '--update', parser.add_argument('-u', '--update',

View file

@ -22,7 +22,7 @@ GDBSERVER_HOST = ""
def parse_args(): def parse_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument("elffile", help="Zephyr ELF binary") parser.add_argument("elffile", help="Zephyr ELF binary")
parser.add_argument("logfile", help="Coredump binary log file") parser.add_argument("logfile", help="Coredump binary log file")

View file

@ -17,7 +17,7 @@ COREDUMP_ERROR_STR = COREDUMP_PREFIX_STR + "ERROR CANNOT DUMP#"
def parse_args(): def parse_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument("infile", help="Serial Log File") parser.add_argument("infile", help="Serial Log File")
parser.add_argument("outfile", parser.add_argument("outfile",

View file

@ -185,7 +185,7 @@ def node_z_path_id(node):
def parse_args(): def parse_args():
# Returns parsed command-line arguments # Returns parsed command-line arguments
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument("--dts", required=True, help="DTS file") parser.add_argument("--dts", required=True, help="DTS file")
parser.add_argument("--dtc-flags", parser.add_argument("--dtc-flags",
help="'dtc' devicetree compiler flags, some of which " help="'dtc' devicetree compiler flags, some of which "

View file

@ -36,7 +36,7 @@ def binding_paths(bindings_dirs):
def parse_args(): def parse_args():
# Returns parsed command-line arguments # Returns parsed command-line arguments
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument("--kconfig-out", required=True, parser.add_argument("--kconfig-out", required=True,
help="path to write the Kconfig file") help="path to write the Kconfig file")
parser.add_argument("--bindings-dirs", nargs='+', required=True, parser.add_argument("--bindings-dirs", nargs='+', required=True,

View file

@ -52,7 +52,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'python-devicetree',
def parse_args(): def parse_args():
# Returns parsed command-line arguments # Returns parsed command-line arguments
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument("--cmake-out", required=True, parser.add_argument("--cmake-out", required=True,
help="path to write the CMake property file") help="path to write the CMake property file")
parser.add_argument("--edt-pickle", required=True, parser.add_argument("--edt-pickle", required=True,

View file

@ -15,7 +15,7 @@ from github.Issue import Issue
def parse_args() -> argparse.Namespace: def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument('pickle_file', metavar='PICKLE-FILE', type=Path, parser.add_argument('pickle_file', metavar='PICKLE-FILE', type=Path,
help='pickle file containing list of issues') help='pickle file containing list of issues')

View file

@ -70,7 +70,8 @@ def init_logs():
def parse_args(): def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Compare footprint apps RAM and ROM sizes. Note: " description="Compare footprint apps RAM and ROM sizes. Note: "
"To run it you need to set up the same environment as twister.") "To run it you need to set up the same environment as twister.",
allow_abbrev=False)
parser.add_argument('-b', '--base-commit', default=None, parser.add_argument('-b', '--base-commit', default=None,
help="Commit ID to use as base for footprint " help="Commit ID to use as base for footprint "
"compare. Default is parent current commit." "compare. Default is parent current commit."

View file

@ -27,7 +27,7 @@ importer = DictImporter()
def parse_args(): def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Compare footprint sizes of two builds.") description="Compare footprint sizes of two builds.", allow_abbrev=False)
parser.add_argument("file1", help="First file") parser.add_argument("file1", help="First file")
parser.add_argument("file2", help="Second file") parser.add_argument("file2", help="Second file")

View file

@ -705,7 +705,7 @@ def parse_args():
""" """
global args global args
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument("-k", "--kernel", required=True, parser.add_argument("-k", "--kernel", required=True,
help="Zephyr ELF binary") help="Zephyr ELF binary")

View file

@ -12,7 +12,8 @@ import argparse
def parse_args(): def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description="Generate footprint data based on a predefined plan.") description="Generate footprint data based on a predefined plan.",
allow_abbrev=False)
parser.add_argument("-p", "--plan", help="Path of test plan", required=True) parser.add_argument("-p", "--plan", help="Path of test plan", required=True)
return parser.parse_args() return parser.parse_args()

View file

@ -51,7 +51,7 @@ def parse_args():
global args global args
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-d", "--data", help="Data Directory") parser.add_argument("-d", "--data", help="Data Directory")
parser.add_argument("-y", "--dryrun", action="store_true", help="Dry run, do not upload to database") parser.add_argument("-y", "--dryrun", action="store_true", help="Dry run, do not upload to database")

View file

@ -65,7 +65,7 @@ def parse_args():
global args global args
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-i", "--input", required=True, parser.add_argument("-i", "--input", required=True,
help="Input dump data") help="Input dump data")
parser.add_argument("-v", "--verbose", action="count", default=0, parser.add_argument("-v", "--verbose", action="count", default=0,

View file

@ -248,7 +248,7 @@ def parse_and_add_node_to_xml(xml_ele, node):
def parse_args(): def parse_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument("--edt-pickle", required=True, parser.add_argument("--edt-pickle", required=True,
help="path to read the pickled edtlib.EDT object from") help="path to read the pickled edtlib.EDT object from")
parser.add_argument("--compatible", required=True, parser.add_argument("--compatible", required=True,

View file

@ -54,7 +54,7 @@ def _parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawDescriptionHelpFormatter,
description=__doc__) description=__doc__, allow_abbrev=False)
parser.add_argument( parser.add_argument(
"-m", "--maintainers", "-m", "--maintainers",

View file

@ -250,7 +250,7 @@ def write_kconfig_filenames(kconf, kconfig_list_path):
def parse_args(): def parse_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument("--handwritten-input-configs", parser.add_argument("--handwritten-input-configs",
action="store_true", action="store_true",

View file

@ -6202,14 +6202,14 @@ def standard_kconfig(description=None):
Exits with sys.exit() (which raises SystemExit) on errors. Exits with sys.exit() (which raises SystemExit) on errors.
description (default: None): description (default: None):
The 'description' passed to argparse.ArgumentParser(). The 'description' passed to argparse.ArgumentParser(allow_abbrev=False).
argparse.RawDescriptionHelpFormatter is used, so formatting is preserved. argparse.RawDescriptionHelpFormatter is used, so formatting is preserved.
""" """
import argparse import argparse
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=argparse.RawDescriptionHelpFormatter,
description=description) description=description, allow_abbrev=False)
parser.add_argument( parser.add_argument(
"kconfig", "kconfig",

View file

@ -56,7 +56,7 @@ def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
formatter_class=argparse.RawTextHelpFormatter, formatter_class=argparse.RawTextHelpFormatter,
description=__doc__) description=__doc__, allow_abbrev=False)
parser.add_argument( parser.add_argument(
"-n", "--check-always-n", "-n", "--check-always-n",

View file

@ -88,7 +88,7 @@ def find_arch2board_set_in(root, arches):
return ret return ret
def parse_args(): def parse_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
add_args(parser) add_args(parser)
return parser.parse_args() return parser.parse_args()

View file

@ -74,7 +74,7 @@ ACCEPTABLE_ESCAPE_CHARS = [
def parse_args(): def parse_args():
"""Parse command line arguments""" """Parse command line arguments"""
argparser = argparse.ArgumentParser() argparser = argparse.ArgumentParser(allow_abbrev=False)
argparser.add_argument("elffile", help="Zephyr ELF binary") argparser.add_argument("elffile", help="Zephyr ELF binary")
argparser.add_argument("--build", help="Build ID") argparser.add_argument("--build", help="Build ID")

View file

@ -28,7 +28,7 @@ LOG_HEX_SEP = "##ZLOGV1##"
def parse_args(): def parse_args():
"""Parse command line arguments""" """Parse command line arguments"""
argparser = argparse.ArgumentParser() argparser = argparse.ArgumentParser(allow_abbrev=False)
argparser.add_argument("dbfile", help="Dictionary Logging Database file") argparser.add_argument("dbfile", help="Dictionary Logging Database file")
argparser.add_argument("logfile", help="Log Data file") argparser.add_argument("logfile", help="Log Data file")

View file

@ -35,7 +35,7 @@ For more information, see:
https://pygithub.readthedocs.io/en/latest/github_objects/Issue.html https://pygithub.readthedocs.io/en/latest/github_objects/Issue.html
- pickle: https://docs.python.org/3/library/pickle.html - pickle: https://docs.python.org/3/library/pickle.html
''', ''',
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument('out_file', metavar='OUTFILE', type=Path, nargs='?', parser.add_argument('out_file', metavar='OUTFILE', type=Path, nargs='?',
help='''file to write pickle data to (default: help='''file to write pickle data to (default:
stdout)''') stdout)''')

View file

@ -39,7 +39,8 @@ def add_parse_arguments(parser = None):
if parser is None: if parser is None:
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter,
allow_abbrev=False)
parser.fromfile_prefix_chars = "+" parser.fromfile_prefix_chars = "+"
case_select = parser.add_argument_group("Test case selection", case_select = parser.add_argument_group("Test case selection",

View file

@ -22,7 +22,7 @@ from github import Github
def parse_args(): def parse_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument('-a', '--all', dest='all', parser.add_argument('-a', '--all', dest='all',
help='Show all bugs squashed', action='store_true') help='Show all bugs squashed', action='store_true')
parser.add_argument('-t', '--token', dest='tokenfile', parser.add_argument('-t', '--token', dest='tokenfile',

View file

@ -56,7 +56,7 @@ def valid_date_type(arg_date_str):
def parse_args(): def parse_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument('-t', '--token', dest='tokenfile', parser.add_argument('-t', '--token', dest='tokenfile',
help='File containing GitHub token (alternatively, use GITHUB_TOKEN env variable)', metavar='FILE') help='File containing GitHub token (alternatively, use GITHUB_TOKEN env variable)', metavar='FILE')
parser.add_argument('-b', '--base', dest='base', parser.add_argument('-b', '--base', dest='base',

View file

@ -119,7 +119,7 @@ def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-o", "--org", default="zephyrproject-rtos", parser.add_argument("-o", "--org", default="zephyrproject-rtos",
help="Github organisation") help="Github organisation")

View file

@ -24,7 +24,7 @@ def parse_args():
global args global args
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-M", "--maintainer-file", required=False, default="MAINTAINERS.yml", parser.add_argument("-M", "--maintainer-file", required=False, default="MAINTAINERS.yml",
help="Maintainer file to be used.") help="Maintainer file to be used.")

View file

@ -118,7 +118,7 @@ def flash_kernel(device_id, input_sof, kernel_hex):
pof_file.close() pof_file.close()
def main(): def main():
parser = argparse.ArgumentParser(description="Flash zephyr onto Altera boards") parser = argparse.ArgumentParser(description="Flash zephyr onto Altera boards", allow_abbrev=False)
parser.add_argument("-s", "--sof", parser.add_argument("-s", "--sof",
help=".sof file with Nios II CPU configuration") help=".sof file with Nios II CPU configuration")
parser.add_argument("-k", "--kernel", parser.add_argument("-k", "--kernel",

View file

@ -31,7 +31,7 @@ except ImportError:
def parse_args(): def parse_args():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-t", "--trace", parser.add_argument("-t", "--trace",
required=True, required=True,
help="tracing data (directory with metadata and trace file)") help="tracing data (directory with metadata and trace file)")

View file

@ -15,7 +15,7 @@ def parse_args():
global args global args
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-d", "--serial_port", required=True, parser.add_argument("-d", "--serial_port", required=True,
help="serial port") help="serial port")
parser.add_argument("-b", "--serial_baudrate", required=True, parser.add_argument("-b", "--serial_baudrate", required=True,

View file

@ -16,7 +16,7 @@ def parse_args():
global args global args
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description=__doc__, description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter) formatter_class=argparse.RawDescriptionHelpFormatter, allow_abbrev=False)
parser.add_argument("-v", "--vendor_id", required=True, parser.add_argument("-v", "--vendor_id", required=True,
help="usb device vendor id") help="usb device vendor id")
parser.add_argument("-p", "--product_id", required=True, parser.add_argument("-p", "--product_id", required=True,

View file

@ -75,7 +75,7 @@ def update_includes(project, dry_run):
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument( parser.add_argument(
"-p", "--project", type=Path, required=True, help="Zephyr-based project path" "-p", "--project", type=Path, required=True, help="Zephyr-based project path"
) )

View file

@ -151,7 +151,7 @@ def process_tree(project):
process_file(p) process_file(p)
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
parser.add_argument( parser.add_argument(
"-r", "--root", type=Path, required=True, help="Zephyr-based project path" "-r", "--root", type=Path, required=True, help="Zephyr-based project path"
) )

View file

@ -665,7 +665,7 @@ def main(input_file: Path, no_backup: bool, skip_nrf_check: bool, header: str) -
if __name__ == "__main__": if __name__ == "__main__":
parser = argparse.ArgumentParser("pinctrl migration utility for nRF") parser = argparse.ArgumentParser("pinctrl migration utility for nRF", allow_abbrev=False)
parser.add_argument( parser.add_argument(
"-i", "--input", type=Path, required=True, help="Board DTS file" "-i", "--input", type=Path, required=True, help="Board DTS file"
) )

View file

@ -224,7 +224,7 @@ def do_run_common_image(command, user_args, user_runner_args, build_dir=None):
# arguments # arguments
# - create a RunnerConfig using 'user_args' and the result # - create a RunnerConfig using 'user_args' and the result
# of parsing 'final_argv' # of parsing 'final_argv'
parser = argparse.ArgumentParser(prog=runner_name) parser = argparse.ArgumentParser(prog=runner_name, allow_abbrev=False)
add_parser_common(command, parser=parser) add_parser_common(command, parser=parser)
runner_cls.add_parser(parser) runner_cls.add_parser(parser)
args, unknown = parser.parse_known_args(args=final_argv) args, unknown = parser.parse_known_args(args=final_argv)
@ -504,7 +504,7 @@ def dump_runner_option_help(cls, indent=''):
# Print help text for class-specific command line options for the # Print help text for class-specific command line options for the
# given runner class. # given runner class.
dummy_parser = argparse.ArgumentParser(prog='', add_help=False) dummy_parser = argparse.ArgumentParser(prog='', add_help=False, allow_abbrev=False)
cls.add_parser(dummy_parser) cls.add_parser(dummy_parser)
formatter = dummy_parser._get_formatter() formatter = dummy_parser._get_formatter()
for group in dummy_parser._action_groups: for group in dummy_parser._action_groups:

View file

@ -71,7 +71,7 @@ def test_blackmagicprobe_init(cc, req, command, runner_config):
def test_blackmagicprobe_create(cc, req, command, runner_config): def test_blackmagicprobe_create(cc, req, command, runner_config):
'''Test commands using a runner created from command line parameters.''' '''Test commands using a runner created from command line parameters.'''
args = ['--gdb-serial', TEST_GDB_SERIAL] args = ['--gdb-serial', TEST_GDB_SERIAL]
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
BlackMagicProbeRunner.add_parser(parser) BlackMagicProbeRunner.add_parser(parser)
arg_namespace = parser.parse_args(args) arg_namespace = parser.parse_args(args)
runner = BlackMagicProbeRunner.create(runner_config, arg_namespace) runner = BlackMagicProbeRunner.create(runner_config, arg_namespace)
@ -84,7 +84,7 @@ def test_blackmagicprobe_create(cc, req, command, runner_config):
def test_blackmagicprobe_connect_rst(cc, req, command, runner_config): def test_blackmagicprobe_connect_rst(cc, req, command, runner_config):
'''Test that commands list the correct connect_rst value when enabled.''' '''Test that commands list the correct connect_rst value when enabled.'''
args = ['--gdb-serial', TEST_GDB_SERIAL, '--connect-rst'] args = ['--gdb-serial', TEST_GDB_SERIAL, '--connect-rst']
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
BlackMagicProbeRunner.add_parser(parser) BlackMagicProbeRunner.add_parser(parser)
arg_namespace = parser.parse_args(args) arg_namespace = parser.parse_args(args)
runner = BlackMagicProbeRunner.create(runner_config, arg_namespace) runner = BlackMagicProbeRunner.create(runner_config, arg_namespace)

View file

@ -209,7 +209,7 @@ def test_bossac_create(cc, req, get_cod_par, sup, runner_config, tmpdir):
no --offset no --offset
""" """
args = ['--bossac-port', str(TEST_BOSSAC_PORT)] args = ['--bossac-port', str(TEST_BOSSAC_PORT)]
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
BossacBinaryRunner.add_parser(parser) BossacBinaryRunner.add_parser(parser)
arg_namespace = parser.parse_args(args) arg_namespace = parser.parse_args(args)
runner_config = adjust_runner_config(runner_config, tmpdir, DOTCONFIG_STD) runner_config = adjust_runner_config(runner_config, tmpdir, DOTCONFIG_STD)
@ -247,7 +247,7 @@ def test_bossac_create_with_speed(cc, req, get_cod_par, sup, runner_config, tmpd
""" """
args = ['--bossac-port', str(TEST_BOSSAC_PORT), args = ['--bossac-port', str(TEST_BOSSAC_PORT),
'--speed', str(TEST_BOSSAC_SPEED)] '--speed', str(TEST_BOSSAC_SPEED)]
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
BossacBinaryRunner.add_parser(parser) BossacBinaryRunner.add_parser(parser)
arg_namespace = parser.parse_args(args) arg_namespace = parser.parse_args(args)
runner_config = adjust_runner_config(runner_config, tmpdir, DOTCONFIG_STD) runner_config = adjust_runner_config(runner_config, tmpdir, DOTCONFIG_STD)
@ -287,7 +287,7 @@ def test_bossac_create_with_flash_address(cc, req, get_cod_par, sup,
'--bossac-port', '--bossac-port',
str(TEST_BOSSAC_PORT), str(TEST_BOSSAC_PORT),
] ]
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
BossacBinaryRunner.add_parser(parser) BossacBinaryRunner.add_parser(parser)
arg_namespace = parser.parse_args(args) arg_namespace = parser.parse_args(args)
runner_config = adjust_runner_config(runner_config, tmpdir, runner_config = adjust_runner_config(runner_config, tmpdir,

View file

@ -69,7 +69,7 @@ def test_canopen_program_create(cpd, test_case, runner_config):
mock.wait_for_flash_status_ok.return_value = 0 mock.wait_for_flash_status_ok.return_value = 0
mock.swid.return_value = 0 mock.swid.return_value = 0
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
CANopenBinaryRunner.add_parser(parser) CANopenBinaryRunner.add_parser(parser)
arg_namespace = parser.parse_args(args) arg_namespace = parser.parse_args(args)
runner = CANopenBinaryRunner.create(runner_config, arg_namespace) runner = CANopenBinaryRunner.create(runner_config, arg_namespace)

View file

@ -69,7 +69,7 @@ def test_dediprog_create(cc, req, tc, runner_config):
args = ['--spi-image', spi_image, '--retries', '0'] args = ['--spi-image', spi_image, '--retries', '0']
if vcc: if vcc:
args.extend(['--vcc', vcc]) args.extend(['--vcc', vcc])
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
DediProgBinaryRunner.add_parser(parser) DediProgBinaryRunner.add_parser(parser)
arg_namespace = parser.parse_args(args) arg_namespace = parser.parse_args(args)
runner = DediProgBinaryRunner.create(runner_config, arg_namespace) runner = DediProgBinaryRunner.create(runner_config, arg_namespace)

View file

@ -128,7 +128,7 @@ def test_dfu_util_create(cc, req, gfa, find_device, tc, runner_config, tmpdir):
f.write('\n') f.write('\n')
runner_config = runner_config._replace(build_dir=os.fspath(tmpdir)) runner_config = runner_config._replace(build_dir=os.fspath(tmpdir))
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
DfuUtilBinaryRunner.add_parser(parser) DfuUtilBinaryRunner.add_parser(parser)
arg_namespace = parser.parse_args(args) arg_namespace = parser.parse_args(args)
runner = DfuUtilBinaryRunner.create(runner_config, arg_namespace) runner = DfuUtilBinaryRunner.create(runner_config, arg_namespace)

View file

@ -62,7 +62,7 @@ def test_gd32isp_create(cc, req, runner_config):
'--speed', TEST_GD32ISP_SPEED, '--speed', TEST_GD32ISP_SPEED,
'--addr', TEST_GD32ISP_ADDR, '--addr', TEST_GD32ISP_ADDR,
'--isp', TEST_GD32ISP_CLI_T] '--isp', TEST_GD32ISP_CLI_T]
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
Gd32ispBinaryRunner.add_parser(parser) Gd32ispBinaryRunner.add_parser(parser)
arg_namespace = parser.parse_args(args) arg_namespace = parser.parse_args(args)
runner = Gd32ispBinaryRunner.create(runner_config, arg_namespace) runner = Gd32ispBinaryRunner.create(runner_config, arg_namespace)

View file

@ -21,7 +21,7 @@ TEST_BOARD_NSIM_ARGS = '@' + path.join(RC_BOARD_DIR, 'support', TEST_NSIM_ARGS)
# mdb-nsim # mdb-nsim
TEST_NSIM_FLASH_CASES = [ TEST_NSIM_FLASH_CASES = [
{ {
'i': ['--cores=1', '--nsim=' + TEST_NSIM_ARGS], 'i': ['--cores=1', '--nsim_args=' + TEST_NSIM_ARGS],
'o': [TEST_DRIVER_CMD, '-nooptions', '-nogoifmain', 'o': [TEST_DRIVER_CMD, '-nooptions', '-nogoifmain',
'-toggle=include_local_symbols=1', '-toggle=include_local_symbols=1',
'-nsim', TEST_BOARD_NSIM_ARGS, '-nsim', TEST_BOARD_NSIM_ARGS,
@ -30,7 +30,7 @@ TEST_NSIM_FLASH_CASES = [
TEST_NSIM_DEBUG_CASES = [ TEST_NSIM_DEBUG_CASES = [
{ {
'i': ['--cores=1', '--nsim=' + TEST_NSIM_ARGS], 'i': ['--cores=1', '--nsim_args=' + TEST_NSIM_ARGS],
'o': [TEST_DRIVER_CMD, '-nooptions', '-nogoifmain', 'o': [TEST_DRIVER_CMD, '-nooptions', '-nogoifmain',
'-toggle=include_local_symbols=1', '-toggle=include_local_symbols=1',
'-nsim', TEST_BOARD_NSIM_ARGS, '-nsim', TEST_BOARD_NSIM_ARGS,
@ -38,7 +38,7 @@ TEST_NSIM_DEBUG_CASES = [
] ]
}] }]
TEST_NSIM_MULTICORE_CASES = [['--cores=2', '--nsim=' + TEST_NSIM_ARGS]] TEST_NSIM_MULTICORE_CASES = [['--cores=2', '--nsim_args=' + TEST_NSIM_ARGS]]
TEST_NSIM_CORE1 = [TEST_DRIVER_CMD, '-pset=1', '-psetname=core0', '', TEST_NSIM_CORE1 = [TEST_DRIVER_CMD, '-pset=1', '-psetname=core0', '',
'-nooptions', '-nogoifmain', '-toggle=include_local_symbols=1', '-nooptions', '-nogoifmain', '-toggle=include_local_symbols=1',
'-nsim', TEST_BOARD_NSIM_ARGS, RC_KERNEL_ELF] '-nsim', TEST_BOARD_NSIM_ARGS, RC_KERNEL_ELF]
@ -121,7 +121,7 @@ def mdb(runner_config, tmpdir, mdb_runner):
if isinstance(args, dict): if isinstance(args, dict):
return mdb_runner(runner_config, TEST_TARGET, **args) return mdb_runner(runner_config, TEST_TARGET, **args)
elif isinstance(args, list): elif isinstance(args, list):
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
mdb_runner.add_parser(parser) mdb_runner.add_parser(parser)
arg_namespace = parser.parse_args(args) arg_namespace = parser.parse_args(args)
return mdb_runner.create(runner_config, arg_namespace) return mdb_runner.create(runner_config, arg_namespace)

View file

@ -479,7 +479,7 @@ def test_nrfjprog_create(check_call, get_snr, require, test_case,
if test_case.recover: if test_case.recover:
args.append('--recover') args.append('--recover')
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
NrfJprogBinaryRunner.add_parser(parser) NrfJprogBinaryRunner.add_parser(parser)
arg_namespace = parser.parse_args(args) arg_namespace = parser.parse_args(args)
runner = NrfJprogBinaryRunner.create(runner_config, arg_namespace) runner = NrfJprogBinaryRunner.create(runner_config, arg_namespace)

View file

@ -141,7 +141,7 @@ def pyocd(runner_config, tmpdir):
if isinstance(args, dict): if isinstance(args, dict):
return PyOcdBinaryRunner(runner_config, TEST_TARGET, **args) return PyOcdBinaryRunner(runner_config, TEST_TARGET, **args)
elif isinstance(args, list): elif isinstance(args, list):
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
PyOcdBinaryRunner.add_parser(parser) PyOcdBinaryRunner.add_parser(parser)
arg_namespace = parser.parse_args(args) arg_namespace = parser.parse_args(args)
return PyOcdBinaryRunner.create(runner_config, arg_namespace) return PyOcdBinaryRunner.create(runner_config, arg_namespace)

View file

@ -384,7 +384,7 @@ def test_stm32cubeprogrammer_create(
if tc["frequency"]: if tc["frequency"]:
args.extend(["--frequency", tc["frequency"]]) args.extend(["--frequency", tc["frequency"]])
if tc["reset_mode"]: if tc["reset_mode"]:
args.extend(["--reset", tc["reset_mode"]]) args.extend(["--reset-mode", tc["reset_mode"]])
if tc["conn_modifiers"]: if tc["conn_modifiers"]:
args.extend(["--conn-modifiers", tc["conn_modifiers"]]) args.extend(["--conn-modifiers", tc["conn_modifiers"]])
if tc["cli"]: if tc["cli"]:
@ -396,7 +396,7 @@ def test_stm32cubeprogrammer_create(
if tc["tool_opt"]: if tc["tool_opt"]:
args.extend(["--tool-opt", " " + tc["tool_opt"][0]]) args.extend(["--tool-opt", " " + tc["tool_opt"][0]])
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
STM32CubeProgrammerBinaryRunner.add_parser(parser) STM32CubeProgrammerBinaryRunner.add_parser(parser)
arg_namespace = parser.parse_args(args) arg_namespace = parser.parse_args(args)

View file

@ -102,7 +102,7 @@ def test_stm32flash_create(cc, req, action, runner_config):
else: else:
args = ['--action', action, '--baud-rate', TEST_BAUD, '--start-addr', TEST_ADDR] args = ['--action', action, '--baud-rate', TEST_BAUD, '--start-addr', TEST_ADDR]
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
Stm32flashBinaryRunner.add_parser(parser) Stm32flashBinaryRunner.add_parser(parser)
arg_namespace = parser.parse_args(args) arg_namespace = parser.parse_args(args)
runner = Stm32flashBinaryRunner.create(runner_config, arg_namespace) runner = Stm32flashBinaryRunner.create(runner_config, arg_namespace)

View file

@ -539,7 +539,7 @@ def parse_modules(zephyr_base, manifest=None, west_projs=None, modules=None,
def main(): def main():
parser = argparse.ArgumentParser(description=''' parser = argparse.ArgumentParser(description='''
Process a list of projects and create Kconfig / CMake include files for Process a list of projects and create Kconfig / CMake include files for
projects which are also a Zephyr module''') projects which are also a Zephyr module''', allow_abbrev=False)
parser.add_argument('--kconfig-out', parser.add_argument('--kconfig-out',
help="""File to write with resulting KConfig import help="""File to write with resulting KConfig import

View file

@ -237,7 +237,7 @@ def build_header(chip, spi_config, hdr_spi_loc, pld_spi_loc, pld_entry_addr, pld
return bytes(hdr) return bytes(hdr)
def parse_args(): def parse_args():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser(allow_abbrev=False)
# Use a lambda to handle base 10 or base 16 (hex) input # Use a lambda to handle base 10 or base 16 (hex) input
parser.add_argument("-c", parser.add_argument("-c",
type=str, type=str,

View file

@ -180,7 +180,7 @@ def _create_parser(arg_list):
else parses the given string else parses the given string
""" """
parser = argparse.ArgumentParser(conflict_handler='resolve') parser = argparse.ArgumentParser(conflict_handler='resolve', allow_abbrev=False)
parser.add_argument("-i", nargs='?', dest="input") parser.add_argument("-i", nargs='?', dest="input")
parser.add_argument("-o", nargs='?', dest="output") parser.add_argument("-o", nargs='?', dest="output")
parser.add_argument("-chip", dest="chip") parser.add_argument("-chip", dest="chip")

View file

@ -683,7 +683,7 @@ async def main():
ipc_command(dsp.HIPCTDR & ~0x80000000, dsp.HIPCTDD) ipc_command(dsp.HIPCTDR & ~0x80000000, dsp.HIPCTDD)
ap = argparse.ArgumentParser(description="DSP loader/logger tool") ap = argparse.ArgumentParser(description="DSP loader/logger tool", allow_abbrev=False)
ap.add_argument("-q", "--quiet", action="store_true", ap.add_argument("-q", "--quiet", action="store_true",
help="No loader output, just DSP logging") help="No loader output, just DSP logging")
ap.add_argument("-v", "--verbose", action="store_true", ap.add_argument("-v", "--verbose", action="store_true",

View file

@ -123,7 +123,7 @@ def main():
client = cavstool_client(HOST, PORT, args) client = cavstool_client(HOST, PORT, args)
client.send_cmd(CMD_DOWNLOAD) client.send_cmd(CMD_DOWNLOAD)
ap = argparse.ArgumentParser(description="DSP loader/logger client tool") ap = argparse.ArgumentParser(description="DSP loader/logger client tool", allow_abbrev=False)
ap.add_argument("-q", "--quiet", action="store_true", ap.add_argument("-q", "--quiet", action="store_true",
help="No loader output, just DSP logging") help="No loader output, just DSP logging")
ap.add_argument("-l", "--log-only", action="store_true", ap.add_argument("-l", "--log-only", action="store_true",

View file

@ -260,7 +260,7 @@ class board_config():
return self.params return self.params
ap = argparse.ArgumentParser(description="RemoteHW service tool") ap = argparse.ArgumentParser(description="RemoteHW service tool", allow_abbrev=False)
ap.add_argument("-q", "--quiet", action="store_true", ap.add_argument("-q", "--quiet", action="store_true",
help="No loader output, just DSP logging") help="No loader output, just DSP logging")
ap.add_argument("-v", "--verbose", action="store_true", ap.add_argument("-v", "--verbose", action="store_true",

View file

@ -11,7 +11,7 @@ from math import ceil
CHUNK = "This is a fragment of generated C string. " CHUNK = "This is a fragment of generated C string. "
parser = ArgumentParser(description="Generate C string of arbitrary size") parser = ArgumentParser(description="Generate C string of arbitrary size", allow_abbrev=False)
parser.add_argument("-s", "--size", help="Size of string (without NULL termination)", parser.add_argument("-s", "--size", help="Size of string (without NULL termination)",
required=True, type=int) required=True, type=int)
parser.add_argument("filepath", help="Output filepath") parser.add_argument("filepath", help="Output filepath")