Skip to content

Commit 5709b55

Browse files
pdgendtjhedberg
authored andcommitted
scripts: west_commands: Convert sysbuild argument to BooleanOptionalAction
Instead of using a mutually exclusive group for sysbuild/no-sysbuild argparse arguments, use the argparse.BooleanOptionalAction to allow passing multiple arguments, where the last one is applied. This is consistent with for example gcc compiler flags. Signed-off-by: Pieter De Gendt <[email protected]>
1 parent 4896194 commit 5709b55

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

scripts/west_commands/build.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,8 @@ def do_add_parser(self, parser_adder):
170170
-DEXTRA_DTC_OVERLAY_FILE... cmake arguments: the results are
171171
undefined''')
172172

173-
group = parser.add_mutually_exclusive_group()
174-
group.add_argument('--sysbuild', action='store_true',
175-
help='''create multi domain build system''')
176-
group.add_argument('--no-sysbuild', action='store_true',
177-
help='''do not create multi domain build system
178-
(default)''')
173+
group.add_argument('--sysbuild', action=argparse.BooleanOptionalAction,
174+
help='''create multi domain build system or disable it (default)''')
179175

180176
group = parser.add_argument_group('pristine builds',
181177
PRISTINE_DESCRIPTION)
@@ -645,12 +641,12 @@ def _run_cmake(self, board, origin, cmake_opts):
645641
cmake_opts.extend(shlex.split(user_args))
646642

647643
config_sysbuild = config_getboolean('sysbuild', False)
648-
if self.args.sysbuild or (config_sysbuild and not self.args.no_sysbuild):
644+
if self.args.sysbuild is True or (config_sysbuild and self.args.sysbuild is not False):
649645
cmake_opts.extend([f'-S{SYSBUILD_PROJ_DIR}'])
650646
cmake_env = os.environ.copy()
651647
cmake_env["APP_DIR"] = str(self.source_dir)
652648
else:
653-
# self.args.no_sysbuild == True or config sysbuild False
649+
# self.args.sysbuild == False or config sysbuild False
654650
cmake_opts.extend([f'-S{self.source_dir}'])
655651

656652
# Invoke CMake from the current working directory using the

0 commit comments

Comments
 (0)