qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 09/29] qapi-gen: Convert from getopt to argpa


From: Markus Armbruster
Subject: Re: [Qemu-devel] [PATCH v2 09/29] qapi-gen: Convert from getopt to argparse
Date: Fri, 23 Feb 2018 18:21:45 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux)

Michael Roth <address@hidden> writes:

> Quoting Markus Armbruster (2018-02-11 03:35:47)
>> argparse is nicer to use than getopt, and gives us --help almost for
>> free.
>> 
>> Signed-off-by: Markus Armbruster <address@hidden>
>> ---
>>  scripts/qapi-gen.py    | 48 ++++++++++++++++++++++++++++++------------------
>>  scripts/qapi/common.py | 43 -------------------------------------------
>>  2 files changed, 30 insertions(+), 61 deletions(-)
>> 
>> diff --git a/scripts/qapi-gen.py b/scripts/qapi-gen.py
>> index 2100ca1145..e5be484e3e 100755
>> --- a/scripts/qapi-gen.py
>> +++ b/scripts/qapi-gen.py
>> @@ -4,8 +4,11 @@
>>  # This work is licensed under the terms of the GNU GPL, version 2 or later.
>>  # See the COPYING file in the top-level directory.
>> 
>> +from __future__ import print_function
>> +import argparse
>> +import re
>>  import sys
>> -from qapi.common import parse_command_line, QAPISchema
>> +from qapi.common import QAPISchema
>>  from qapi.types import gen_types
>>  from qapi.visit import gen_visit
>>  from qapi.commands import gen_commands
>> @@ -15,26 +18,35 @@ from qapi.doc import gen_doc
>> 
>> 
>>  def main(argv):
>> -    (input_file, output_dir, prefix, opts) = \
>> -        parse_command_line('bu', ['builtins', 'unmask-non-abi-names'])
>> +    parser = argparse.ArgumentParser(
>> +        description='Generate code from a QAPI schema')
>> +    parser.add_argument('-b', '--builtins', action='store_true',
>> +                        help="generate code for built-in types")
>> +    parser.add_argument('-o', '--output_dir', action='store', default='',
>
> Was the change from --output-dir to --output_dir intentional? The former
> seems more consistent.

Editing accident, good catch!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]