]> www.infradead.org Git - users/dwmw2/qemu.git/commitdiff
qapi: adapt to moved location of StringIO module in py3
authorDaniel P. Berrange <berrange@redhat.com>
Tue, 16 Jan 2018 13:42:07 +0000 (13:42 +0000)
committerEduardo Habkost <ehabkost@redhat.com>
Mon, 5 Feb 2018 21:53:54 +0000 (19:53 -0200)
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <20180116134217.8725-5-berrange@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
scripts/qapi.py

index 514b7bb5a48d44d664a95e8fbe74d038ae62a24e..514cca44bfe3b71b1b26bea218d7a4807530c928 100644 (file)
@@ -22,6 +22,10 @@ try:
     from collections import OrderedDict
 except:
     from ordereddict import OrderedDict
+try:
+    from StringIO import StringIO
+except ImportError:
+    from io import StringIO
 
 builtin_types = {
     'null':     'QTYPE_QNULL',
@@ -1995,8 +1999,7 @@ def open_output(output_dir, do_c, do_h, prefix, c_file, h_file,
         if really:
             return open(name, opt)
         else:
-            import StringIO
-            return StringIO.StringIO()
+            return StringIO()
 
     fdef = maybe_open(do_c, c_file, 'w')
     fdecl = maybe_open(do_h, h_file, 'w')