Markus Armbruster <arm...@redhat.com> writes: > Marc-Andre Lureau <mlur...@redhat.com> writes: > >> On Fri, Feb 2, 2018 at 2:03 PM, Markus Armbruster <arm...@redhat.com> wrote: [...] >>> diff --git a/scripts/qapi2texi.py b/scripts/qapi/doc.py >>> old mode 100755 >>> new mode 100644 >>> similarity index 92% >>> rename from scripts/qapi2texi.py >>> rename to scripts/qapi/doc.py >>> index 924b374cd3..1f57f6e1c2 >>> --- a/scripts/qapi2texi.py >>> +++ b/scripts/qapi/doc.py >>> @@ -4,10 +4,9 @@ >>> # This work is licensed under the terms of the GNU LGPL, version 2+. >>> # See the COPYING file in the top-level directory. >>> """This script produces the documentation of a qapi schema in texinfo >>> format""" >>> + >>> import re >>> -import sys >>> - >>> -import qapi >>> +import qapi.common >>> >>> MSG_FMT = """ >>> @deftypefn {type} {{}} {name} >>> @@ -196,7 +195,7 @@ def texi_entity(doc, what, base=None, variants=None, >>> + texi_sections(doc)) >>> >>> >>> -class QAPISchemaGenDocVisitor(qapi.QAPISchemaVisitor): >>> +class QAPISchemaGenDocVisitor(qapi.common.QAPISchemaVisitor): >> >> Would be a bit easier to read and more consitent with a top-level >> "from qapi.common import QAPISchemaVisitor" > > Can do.
The obvious patch (appended) doesn't work, because doc_required is always False in gen_doc(). WTF?!? [...] diff --git a/scripts/qapi/doc.py b/scripts/qapi/doc.py index 4027722032..919e77b79e 100644 --- a/scripts/qapi/doc.py +++ b/scripts/qapi/doc.py @@ -7,7 +7,7 @@ from __future__ import print_function import re -import qapi.common +from qapi.common import doc_required, QAPIGenDoc, QAPISchemaVisitor MSG_FMT = """ @deftypefn {type} {{}} {name} @@ -196,7 +196,7 @@ def texi_entity(doc, what, base=None, variants=None, + texi_sections(doc)) -class QAPISchemaGenDocVisitor(qapi.common.QAPISchemaVisitor): +class QAPISchemaGenDocVisitor(QAPISchemaVisitor): def __init__(self): self.out = None self.cur_doc = None @@ -272,7 +272,7 @@ def texi_schema(schema): def gen_doc(schema, output_dir, prefix): - if qapi.common.doc_required: - gen = qapi.common.QAPIGenDoc() + if doc_required: + gen = QAPIGenDoc() gen.add(texi_schema(schema)) gen.write(output_dir, prefix + 'qapi.texi')