[Buildroot] [PATCH v2 2/2] scripts/autobuild-run: add --no-toolchains-csv option and drop docopt

Thomas Petazzoni thomas.petazzoni at bootlin.com
Wed Apr 13 21:04:07 UTC 2022


On Sat,  9 Apr 2022 22:32:27 -0600
James Hilliard <james.hilliard1 at gmail.com> wrote:

> Since docopt is unmaintained and less flexible than argparse lets
> drop it and migrate to argparse.
> 
> Signed-off-by: James Hilliard <james.hilliard1 at gmail.com>

Thanks! I think it would have been great to split the conversion from
docopt to argparse from the addition of no-toolchains-csv. Regardless
of that, I wanted to apply, but spotted something incorrect in the help
text, showing that the argparse logic is probably wrong. Look:

  --toolchains-csv TOOLCHAINS_CSV
                        Toolchain configuration file (default: support/config-fragments/autobuild/toolchain-
                        configs.csv)
  --no-toolchains-csv   Generate random toolchain configuration (default: support/config-
                        fragments/autobuild/toolchain-configs.csv)

See how --no-toolchains-csv option has a default value... that doesn't
make any sense?

> +    toolchains_csv = parser.add_mutually_exclusive_group(required=False)
> +    toolchains_csv.add_argument("--toolchains-csv",
> +                                dest="toolchains_csv",
> +                                help="Toolchain configuration file",
> +                                type=pathlib.Path)
> +    toolchains_csv.add_argument("--no-toolchains-csv",
> +                                dest="toolchains_csv",
> +                                help="Generate random toolchain configuration",
> +                                action='store_false')
> +    parser.set_defaults(toolchains_csv=pathlib.Path("support/config-fragments/autobuild/toolchain-configs.csv"))

I suppose this is what makes it have this incorrect "default value".

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com



More information about the buildroot mailing list