From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id 423973858C83; Tue, 26 Apr 2022 15:52:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 423973858C83 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb: make some random Python files Python 3-compatible X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 0b60b9634430caebb640ef9b943049bdc6aa8f6f X-Git-Newrev: 6bdd7cf11d503be3b85320668b223fcd5cc9f2f4 Message-Id: <20220426155237.423973858C83@sourceware.org> Date: Tue, 26 Apr 2022 15:52:37 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2022 15:52:37 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D6bdd7cf11d50= 3be3b85320668b223fcd5cc9f2f4 commit 6bdd7cf11d503be3b85320668b223fcd5cc9f2f4 Author: Simon Marchi Date: Tue Apr 26 11:37:46 2022 -0400 gdb: make some random Python files Python 3-compatible =20 I noticed that these files failed to format with Black, because they use print without parenthesis (which isn't Python 3 compatible). =20 I don't know if these files are still relevant, but the change is trivial, so here it is. =20 Change-Id: I116445c2b463486016f824d32effffc915b60766 Diff: --- gdb/contrib/test_pubnames_and_indexes.py | 30 +++++++++++++++-------------= -- gdb/system-gdbinit/elinos.py | 2 +- gdb/system-gdbinit/wrs-linux.py | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/gdb/contrib/test_pubnames_and_indexes.py b/gdb/contrib/test_pu= bnames_and_indexes.py index b87d2e16806..8e89a59263c 100644 --- a/gdb/contrib/test_pubnames_and_indexes.py +++ b/gdb/contrib/test_pubnames_and_indexes.py @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 =20 # Copyright (C) 2011-2022 Free Software Foundation, Inc. # @@ -102,24 +102,24 @@ def CheckSets(list0, list1, name0, name1): =20 difference0 =3D set(list0) - set(list1) if len(difference0) !=3D 0: - print "Elements in " + name0 + " but not " + name1 + ": (", - print len(difference0), - print ")" + print("Elements in " + name0 + " but not " + name1 + ": (", end=3D= " ") + print(len(difference0), end=3D" ") + print(")") for element in difference0: - print " " + element + print(" " + element) =20 difference1 =3D set(list1) - set(list0) if len(difference1) !=3D 0: - print "Elements in " + name1 + " but not " + name0 + ": (", - print len(difference1), - print ")" + print("Elements in " + name1 + " but not " + name0 + ": (", end=3D= " ") + print(len(difference1), end=3D" ") + print(")") for element in difference1: - print " " + element + print(" " + element) =20 if len(difference0) !=3D 0 or len(difference1) !=3D 0: return True =20 - print name0 + " and " + name1 + " are identical." + print(name0 + " and " + name1 + " are identical.") return False =20 =20 @@ -152,7 +152,7 @@ def find_executables(): def main(argv): """The main subprogram.""" if len(argv) !=3D 2: - print "Usage: test_pubnames_and_indexes.py " + print("Usage: test_pubnames_and_indexes.py ") sys.exit(2) =20 find_executables() @@ -200,15 +200,15 @@ def main(argv): =20 # Find the differences between the various indices. if len(gold_index) =3D=3D 0: - print "Gold index is empty" + print("Gold index is empty") failed |=3D True =20 if len(gdb_index) =3D=3D 0: - print "Gdb index is empty" + print("Gdb index is empty") failed |=3D True =20 if len(pubs_list) =3D=3D 0: - print "Pubs list is empty" + print("Pubs list is empty") failed |=3D True =20 failed |=3D CheckSets(gdb_index, gold_index, "gdb index", "gold index") @@ -216,7 +216,7 @@ def main(argv): failed |=3D CheckSets(pubs_list, gdb_index, "pubs list", "gdb index") =20 if failed: - print "Test failed" + print("Test failed") sys.exit(1) =20 =20 diff --git a/gdb/system-gdbinit/elinos.py b/gdb/system-gdbinit/elinos.py index 06724740e73..95a9529bc12 100644 --- a/gdb/system-gdbinit/elinos.py +++ b/gdb/system-gdbinit/elinos.py @@ -21,7 +21,7 @@ import gdb =20 =20 def warn(msg): - print "warning: %s" % msg + print("warning: %s" % msg) =20 =20 def get_elinos_environment(): diff --git a/gdb/system-gdbinit/wrs-linux.py b/gdb/system-gdbinit/wrs-linux= .py index 88e1109a839..e4b225a32de 100644 --- a/gdb/system-gdbinit/wrs-linux.py +++ b/gdb/system-gdbinit/wrs-linux.py @@ -21,5 +21,5 @@ if "ENV_PREFIX" in os.environ: gdb.execute("set sysroot %s" % os.environ["ENV_PREFIX"]) =20 else: - print "warning: ENV_PREFIX environment variable missing." - print "The debugger will probably be unable to find the correct system= libraries" + print("warning: ENV_PREFIX environment variable missing.") + print("The debugger will probably be unable to find the correct system= libraries")