Message ID | 20181213123724.4866-8-marcandre.lureau@redhat.com |
---|---|
State | New |
Headers | show |
Series | qapi: add #if pre-processor conditions to generated code (part 2) | expand |
Marc-André Lureau <marcandre.lureau@redhat.com> writes: > This will allow to get rid of short form handling in a following > patch. > > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> > Suggested-by: Markus Armbruster <armbru@redhat.com> > --- > scripts/qapi/common.py | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py > index bb928d2f7d..569e397147 100644 > --- a/scripts/qapi/common.py > +++ b/scripts/qapi/common.py > @@ -1648,9 +1648,10 @@ class QAPISchema(object): > self.the_empty_object_type = QAPISchemaObjectType( > 'q_empty', None, None, None, None, [], None) > self._def_entity(self.the_empty_object_type) > - qtype_values = self._make_enum_members(['none', 'qnull', 'qnum', > - 'qstring', 'qdict', 'qlist', > - 'qbool']) > + > + qtypes = ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool'] pycodestyle-3 complains: scripts/qapi/common.py:1652:80: E501 line too long (80 > 79 characters) Can tidy up when I apply. > + qtype_values = self._make_enum_members([{'name': n} for n in qtypes]) > + > self._def_entity(QAPISchemaEnumType('QType', None, None, None, > qtype_values, 'QTYPE'))
diff --git a/scripts/qapi/common.py b/scripts/qapi/common.py index bb928d2f7d..569e397147 100644 --- a/scripts/qapi/common.py +++ b/scripts/qapi/common.py @@ -1648,9 +1648,10 @@ class QAPISchema(object): self.the_empty_object_type = QAPISchemaObjectType( 'q_empty', None, None, None, None, [], None) self._def_entity(self.the_empty_object_type) - qtype_values = self._make_enum_members(['none', 'qnull', 'qnum', - 'qstring', 'qdict', 'qlist', - 'qbool']) + + qtypes = ['none', 'qnull', 'qnum', 'qstring', 'qdict', 'qlist', 'qbool'] + qtype_values = self._make_enum_members([{'name': n} for n in qtypes]) + self._def_entity(QAPISchemaEnumType('QType', None, None, None, qtype_values, 'QTYPE'))
This will allow to get rid of short form handling in a following patch. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Suggested-by: Markus Armbruster <armbru@redhat.com> --- scripts/qapi/common.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)