From 50f35039e7df321a309ee45db57d37635bf53ce3 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 30 Nov 2022 15:37:21 -0500 Subject: devenv: avoid overwriting internal variables of the global argparse We already use options.command for the subcommand in use, in this case devenv. We cannot reuse that variable name for the list of words to execute inside the devenv. --- mesonbuild/mdevenv.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mesonbuild/mdevenv.py b/mesonbuild/mdevenv.py index 2fb790423..b75d18b83 100644 --- a/mesonbuild/mdevenv.py +++ b/mesonbuild/mdevenv.py @@ -20,7 +20,7 @@ def add_arguments(parser: argparse.ArgumentParser) -> None: help='Directory to cd into before running') parser.add_argument('--dump', action='store_true', help='Only print required environment (Since 0.62.0)') - parser.add_argument('command', nargs=argparse.REMAINDER, + parser.add_argument('devcmd', nargs=argparse.REMAINDER, metavar='command', help='Command to run in developer environment (default: interactive shell)') def get_windows_shell() -> T.Optional[str]: @@ -131,7 +131,7 @@ def run(options: argparse.Namespace) -> int: devenv, varnames = get_env(b) if options.dump: - if options.command: + if options.devcmd: raise MesonException('--dump option does not allow running other command.') for name in varnames: print(f'{name}={quote_arg(devenv[name])}') @@ -143,7 +143,7 @@ def run(options: argparse.Namespace) -> int: setup_vsenv(b.need_vsenv) - args = options.command + args = options.devcmd if not args: prompt_prefix = f'[{b.project_name}]' shell_env = os.environ.get("SHELL") -- cgit v1.2.3