[libvirt PATCH 1/9] cpu-cpuid: Use argparse to parse arguments
Jiri Denemark
jdenemar at redhat.com
Thu Jan 7 17:14:25 UTC 2021
On Mon, Jan 04, 2021 at 12:30:11 +0100, Tim Wiederhake wrote:
> Using 'argparse' for argument handling simplifies merging this script
> with cpu-gather.py in a later patch.
>
> Signed-off-by: Tim Wiederhake <twiederh at redhat.com>
> ---
> tests/cputestdata/cpu-cpuid.py | 78 +++++++++++++++++++---------------
> 1 file changed, 43 insertions(+), 35 deletions(-)
>
> diff --git a/tests/cputestdata/cpu-cpuid.py b/tests/cputestdata/cpu-cpuid.py
> index dac43debb6..6ca72d2262 100755
> --- a/tests/cputestdata/cpu-cpuid.py
> +++ b/tests/cputestdata/cpu-cpuid.py
...
> +def main():
> + parser = argparse.ArgumentParser(description="Diff cpuid results")
> + subparsers = parser.add_subparsers(dest="action", required=True)
> + diffparser = subparsers.add_parser(
> + "diff",
> + help="Diff json description of CPU model against known features.")
> + diffparser.add_argument(
> + "json_files",
> + nargs="+",
> + metavar="FILE",
> + type=os.path.realpath,
> + help="Path to one or more json CPU model descriptions.")
> + args = parser.parse_args()
> +
> + diff(args)
> + exit(0)
This exit(0) here is redundant, it's removed by the last patch in this
series, and our syntax check doesn't like it. So I just removed this
line before pushing.
Jirka
More information about the libvir-list
mailing list