From patchwork Thu Jun 4 08:53:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Dan_Hor=C3=A1k?= X-Patchwork-Id: 1303358 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49d0256GRnz9sSf for ; Thu, 4 Jun 2020 18:54:05 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=danny.cz Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 49d0255Sl3zDqbt for ; Thu, 4 Jun 2020 18:54:05 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=danny.cz (client-ip=2a02:2b88:2:1::1cde:1; helo=redcrew.org; envelope-from=dan@danny.cz; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=danny.cz Received: from redcrew.org (redcrew.org [IPv6:2a02:2b88:2:1::1cde:1]) by lists.ozlabs.org (Postfix) with ESMTP id 49d0210vHFzDqTF for ; Thu, 4 Jun 2020 18:53:59 +1000 (AEST) Received: from server.danny.cz (72.155.broadband6.iol.cz [88.101.155.72]) by redcrew.org (Postfix) with ESMTP id A5DDB57A for ; Thu, 4 Jun 2020 10:53:51 +0200 (CEST) Received: from talos.danny.cz (talos.danny.cz [192.168.160.116]) by server.danny.cz (Postfix) with ESMTP id CE17711A808 for ; Thu, 4 Jun 2020 10:53:50 +0200 (CEST) From: =?utf-8?q?Dan_Hor=C3=A1k?= To: skiboot@lists.ozlabs.org Date: Thu, 4 Jun 2020 10:53:50 +0200 Message-Id: <20200604085350.10663-1-dan@danny.cz> X-Mailer: git-send-email 2.21.3 MIME-Version: 1.0 Subject: [Skiboot] [PATCH] external: convert scripts to Python3 X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" Convert scripts to Python3 as Python2 has been EOLed in 2020. Fixes: https://github.com/open-power/skiboot/issues/225 Signed-off-by: Dan HorĂ¡k --- external/fwts/generate-fwts-olog | 8 ++++---- external/fwts/merge-fwts-olog | 22 +++++++++++----------- external/xscom-utils/adu_scoms.py | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/external/fwts/generate-fwts-olog b/external/fwts/generate-fwts-olog index c455988de..54fc4fbb3 100755 --- a/external/fwts/generate-fwts-olog +++ b/external/fwts/generate-fwts-olog @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later # # Copyright 2016 Jeremy Kerr @@ -31,7 +31,7 @@ def create_parser(): # Match the following prlog() call log_call = (((Literal("prerror") + Literal('(').suppress()) | (Literal("prlog") + Literal('(').suppress() + - Word(string.letters + string.digits + '_') + + Word(string.ascii_letters + string.digits + '_') + Literal(',').suppress())) + Combine(OneOrMore(QuotedString('"')), adjacent=False) + (Literal(')') | Literal(',')).suppress() @@ -67,7 +67,7 @@ def find_sources(dirname): s.extend([ os.path.join(dname, fname) for fname in fnames if is_source(fname) ]) - os.path.walk(dirname, add_fn, sources) + os.walk(dirname, add_fn, sources) return sources def cleanup_content(content): @@ -212,7 +212,7 @@ if __name__ == '__main__': sources = [] for directory in args.directories: try: - git_tag = subprocess.check_output(["git","-C", directory, "describe", "--abbrev=0" ]) + git_tag = subprocess.check_output(["git","-C", directory, "describe", "--abbrev=0" ], text=True) except: git_tag = "???" git_tag = git_tag.replace("\n", "") diff --git a/external/fwts/merge-fwts-olog b/external/fwts/merge-fwts-olog index 132d8980c..de70d6cfe 100755 --- a/external/fwts/merge-fwts-olog +++ b/external/fwts/merge-fwts-olog @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later # # Copyright 2016 IBM Corp. @@ -14,17 +14,17 @@ json_params = { def get_input(): while True: - resp = raw_input("Update pattern to match both? (y/n): ") + resp = input("Update pattern to match both? (y/n): ") if resp in [ "y", "Y" ]: break elif resp in [ "n", "N" ]: - print "New entry will be added." + print("New entry will be added.") return False else: - print "???" + print("???") continue - return raw_input("New pattern: ") + return input("New pattern: ") def main(): if len(sys.argv) != 4: @@ -69,12 +69,12 @@ def main(): continue if cp["pattern"] != op["pattern"]: - print "Pattern update detected." - print "Label: %s" % cp["label"] - print "" - print "Cur Pattern: %s" % cp["pattern"] - print "New Pattern: %s" % op["pattern"] - print "" + print("Pattern update detected.") + print("Label: %s" % cp["label"]) + print("") + print("Cur Pattern: %s" % cp["pattern"]) + print("New Pattern: %s" % op["pattern"]) + print("") user_pattern = get_input() diff --git a/external/xscom-utils/adu_scoms.py b/external/xscom-utils/adu_scoms.py index cb1c0d274..6273eadb1 100755 --- a/external/xscom-utils/adu_scoms.py +++ b/external/xscom-utils/adu_scoms.py @@ -164,7 +164,7 @@ class GetSCom(object): c_id = val >> 44 id = c_id & 0xff - if id == 0xef: + if id == 0xef: name = "P8E (Murano) processor" elif id == 0xea: name = "P8 (Venice) processor"