summary refs log tree commit diff stats
path: root/scripts/qapi2texi.py
diff options
context:
space:
mode:
authorDaniel P. Berrange <berrange@redhat.com>2018-01-16 13:42:04 +0000
committerEduardo Habkost <ehabkost@redhat.com>2018-02-05 19:53:54 -0200
commitef9d9108917d6d5f903bca31602827e512a51c50 (patch)
tree0614648927647a3b52779268fc55831cac34f0c4 /scripts/qapi2texi.py
parentf24ee107a07f093bd7ed475dd48d7ba57ea3d8fe (diff)
downloadfocaccia-qemu-ef9d9108917d6d5f903bca31602827e512a51c50.tar.gz
focaccia-qemu-ef9d9108917d6d5f903bca31602827e512a51c50.zip
qapi: convert to use python print function instead of statement
Python 3 no longer supports the bare "print" statement, it must be
called as a normal function with round brackets. It is possible to
opt-in to this new syntax with Python 2.6 onwards by importing the
"print_function" from the "__future__" module, making it easy to
support Python 2 and 3 in parallel.

Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <20180116134217.8725-2-berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'scripts/qapi2texi.py')
-rwxr-xr-xscripts/qapi2texi.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/scripts/qapi2texi.py b/scripts/qapi2texi.py
index 92e2af2cd6..70e1fe76ef 100755
--- a/scripts/qapi2texi.py
+++ b/scripts/qapi2texi.py
@@ -4,6 +4,7 @@
 # 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"""
+from __future__ import print_function
 import re
 import sys
 
@@ -274,15 +275,15 @@ def texi_schema(schema):
 def main(argv):
     """Takes schema argument, prints result to stdout"""
     if len(argv) != 2:
-        print >>sys.stderr, "%s: need exactly 1 argument: SCHEMA" % argv[0]
+        print("%s: need exactly 1 argument: SCHEMA" % argv[0], file=sys.stderr)
         sys.exit(1)
 
     schema = qapi.QAPISchema(argv[1])
     if not qapi.doc_required:
-        print >>sys.stderr, ("%s: need pragma 'doc-required' "
-                             "to generate documentation" % argv[0])
+        print("%s: need pragma 'doc-required' "
+               "to generate documentation" % argv[0], file=sys.stderr)
         sys.exit(1)
-    print texi_schema(schema)
+    print(texi_schema(schema))
 
 
 if __name__ == '__main__':