Re: [libvirt PATCH 1/9] cpu-cpuid: Use argparse to parse arguments

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
> ---
>  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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux