mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 10:47:19 +02:00
Tools: Improve idf.py error message when the argument value collides with the environment variable
Closes https://github.com/espressif/esp-idf/issues/10475
This commit is contained in:
11
tools/idf.py
11
tools/idf.py
@ -559,9 +559,14 @@ def init_cli(verbose_output=None):
|
|||||||
default = () if option.multiple else option.default
|
default = () if option.multiple else option.default
|
||||||
|
|
||||||
if global_value != default and local_value != default and global_value != local_value:
|
if global_value != default and local_value != default and global_value != local_value:
|
||||||
raise FatalError(
|
if hasattr(option, 'envvar') and option.envvar and os.getenv(option.envvar) != default:
|
||||||
'Option "%s" provided for "%s" is already defined to a different value. '
|
msg = (f'This option cannot be set in command line if the {option.envvar} '
|
||||||
'This option can appear at most once in the command line.' % (key, task.name))
|
'environment variable is set to a different value.')
|
||||||
|
else:
|
||||||
|
msg = 'This option can appear at most once in the command line.'
|
||||||
|
|
||||||
|
raise FatalError(f'Option "{key}" provided for "{task.name}" is already defined to '
|
||||||
|
f'a different value. {msg}')
|
||||||
if local_value != default:
|
if local_value != default:
|
||||||
global_args[key] = local_value
|
global_args[key] = local_value
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user