From nobody Tue Nov 4 13:04:19 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1504189595767324.34332333075645; Thu, 31 Aug 2017 07:26:35 -0700 (PDT) Received: from localhost ([::1]:56050 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dnQQT-0000ms-AS for importer@patchew.org; Thu, 31 Aug 2017 10:26:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dnQOf-0007qj-C2 for qemu-devel@nongnu.org; Thu, 31 Aug 2017 10:24:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dnQOe-0007ad-Bq for qemu-devel@nongnu.org; Thu, 31 Aug 2017 10:24:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60434) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dnQOe-0007a7-37 for qemu-devel@nongnu.org; Thu, 31 Aug 2017 10:24:40 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1FC537E456; Thu, 31 Aug 2017 14:24:39 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.42.22.189]) by smtp.corp.redhat.com (Postfix) with ESMTP id D3AD27BAE3; Thu, 31 Aug 2017 14:24:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1FC537E456 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=berrange@redhat.com From: "Daniel P. Berrange" To: qemu-devel@nongnu.org Date: Thu, 31 Aug 2017 15:24:26 +0100 Message-Id: <20170831142430.16665-2-berrange@redhat.com> In-Reply-To: <20170831142430.16665-1-berrange@redhat.com> References: <20170831142430.16665-1-berrange@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 31 Aug 2017 14:24:39 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 1/5] qapi: convert to use python print function instead of statement X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Markus Armbruster , Michael Roth Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Get Py2 + 3 compatibility by using the print function instead of print statement. This works for 2.6 onwards. Signed-off-by: Daniel P. Berrange --- scripts/qapi.py | 12 ++++++------ scripts/qapi2texi.py | 9 +++++---- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/scripts/qapi.py b/scripts/qapi.py index 8aa2775f12..a60b79c126 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -11,6 +11,7 @@ # This work is licensed under the terms of the GNU GPL, version 2. # See the COPYING file in the top-level directory. =20 +from __future__ import print_function import errno import getopt import os @@ -1476,7 +1477,7 @@ class QAPISchema(object): self._def_exprs() self.check() except QAPIError as err: - print >>sys.stderr, err + print (err, file=3Dsys.stderr) exit(1) =20 def _def_entity(self, ent): @@ -1936,7 +1937,7 @@ def parse_command_line(extra_options=3D'', extra_long= _options=3D[]): ['source', 'header', 'prefix=3D', 'output-dir=3D'] + extra_long_opti= ons) except getopt.GetoptError as err: - print >>sys.stderr, "%s: %s" % (sys.argv[0], str(err)) + print ("%s: %s" % (sys.argv[0], str(err)), file=3Dsys.stderr) sys.exit(1) =20 output_dir =3D '' @@ -1950,9 +1951,8 @@ def parse_command_line(extra_options=3D'', extra_long= _options=3D[]): if o in ('-p', '--prefix'): match =3D re.match(r'([A-Za-z_.-][A-Za-z0-9_.-]*)?', a) if match.end() !=3D len(a): - print >>sys.stderr, \ - "%s: 'funny character '%s' in argument of --prefix" \ - % (sys.argv[0], a[match.end()]) + print ("%s: 'funny character '%s' in argument of --prefix"= \ + % (sys.argv[0], a[match.end()]), file=3Dsys.stderr) sys.exit(1) prefix =3D a elif o in ('-o', '--output-dir'): @@ -1969,7 +1969,7 @@ def parse_command_line(extra_options=3D'', extra_long= _options=3D[]): do_h =3D True =20 if len(args) !=3D 1: - print >>sys.stderr, "%s: need exactly one argument" % sys.argv[0] + print ("%s: need exactly one argument" % sys.argv[0], file=3Dsys.s= tderr) sys.exit(1) fname =3D args[0] =20 diff --git a/scripts/qapi2texi.py b/scripts/qapi2texi.py index a317526e51..9c57b01bb4 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 form= at""" +from __future__ import print_function import re import sys =20 @@ -285,15 +286,15 @@ def texi_schema(schema): def main(argv): """Takes schema argument, prints result to stdout""" if len(argv) !=3D 2: - print >>sys.stderr, "%s: need exactly 1 argument: SCHEMA" % argv[0] + print ("%s: need exactly 1 argument: SCHEMA" % argv[0], file=3Dsys= .stderr) sys.exit(1) =20 schema =3D 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=3Dsys.stderr) sys.exit(1) - print texi_schema(schema) + print (texi_schema(schema)) =20 =20 if __name__ =3D=3D '__main__': --=20 2.13.5