[PATCH v3 3/5] patman: Make most bool arguments BooleanOptionalAction

Simon Glass sjg at chromium.org
Sat Jul 16 13:55:41 CEST 2022


Hi Doug,

On Thu, 7 Jul 2022 at 09:26, Douglas Anderson <dianders at chromium.org> wrote:
>
> For boolean arguments it's convenient to be able to specify both the
> argument and its opposite on the command line. This is especially
> convenient because you can change the default via the settings file
> and being able express the opposite can be the only way to override
> things.
>
> Luckily python handles this well--we just need to specify things with
> BooleanOptionalAction. We'll do that for all options except
> "full-help" (where it feels silly). This uglifies the help text a
> little bit but does give maximum flexibility.
>
> Signed-off-by: Douglas Anderson <dianders at chromium.org>
> Tested-by: Brian Norris <briannorris at chromium.org>
> Reviewed-by: Brian Norris <briannorris at chromium.org>
> Reviewed-by: Simon Glass <sjg at chromium.org>
> ---
>
> (no changes since v2)
>
> Changes in v2:
> - Fix doc string for --ignore-bad-tags
>
>  tools/patman/main.py | 55 ++++++++++++++++++++++----------------------
>  1 file changed, 28 insertions(+), 27 deletions(-)

Sadly this patch triggers an error:

Traceback (most recent call last):
  File "./tools/patman/patman", line 9, in <module>
    from argparse import ArgumentParser, BooleanOptionalAction
ImportError: cannot import name 'BooleanOptionalAction' from
'argparse' (/usr/lib/python3.8/argparse.py)


I've dropped it and the next one. Can you please take a look?

Regards,
Simon


More information about the U-Boot mailing list