From patchwork Wed Nov 4 06:48:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 83643 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id B81FAA04E7; Wed, 4 Nov 2020 07:49:33 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 97B54C321; Wed, 4 Nov 2020 07:48:59 +0100 (CET) Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by dpdk.org (Postfix) with ESMTP id 24557BE97 for ; Wed, 4 Nov 2020 07:48:54 +0100 (CET) Received: by mail-pg1-f169.google.com with SMTP id 62so8458674pgg.12 for ; Tue, 03 Nov 2020 22:48:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PFsX6joj8+LucDxtxZNyqLzFyGOrNSF26W4kRtBfMww=; b=Nj8P5quIEitEgPZJWX3sR7OVNG5Ed4s6wyb40Rx//MgbT9cv6X4uEslppqA7W0iU01 EGY39n0vq1QQAeEEkPYE8G1qLjV7/ACyh/Wl7X0bWPA4tSEqL8ONs5GTtphpmTVzySsT dp9K+Xs3TmhL0GZMUdg8rzxchw3yt90RzNzBB+qckwnhmltAt8avw3WceWWrwP9BDhYl T4N7zwHNLd6S4JMJGD2MR6xTjQ0aMs3HYkjjBzw7CYv0FPNwF6CUFF4/AjW9X9A8bwQa qfJAg09GbgTflErWPW38g/igPj1uUlDbrGEU3tzNi+PRwzquNhBHWbM8pmy0e4/J28W4 hvvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PFsX6joj8+LucDxtxZNyqLzFyGOrNSF26W4kRtBfMww=; b=ITe2goLZxHo3qMO2Ij+DjjLPME/Js5YuC2BRhLDW2DXLgFzBqAadTP/G74eDiTEvP+ M+XWbT7hQM55rkwJ6l7oMHU1l3syt10KYtge6UA7SPYL8M+yWKibvHFCkZcVb5vOfMHQ KKpTeIgKS45Fot4JaZlXhMFTGE+ysnZik6aZAWaYnnmTjM9rybTZoVUqYwNWzHXPl/tl uwrgdQokv4nfzZNxAfevjVFdsT9utEVjak6qlF+sOnWOHDcFBEVHsx82wWjNXLfrfKJ6 ofyJ94sTRtvWwbJxbIXIIZ1O7Sju754ygGCn6Fl7nU7YqUWPszjl7eS+Gb3QoEnyc/P/ rg4A== X-Gm-Message-State: AOAM532f2KGh8joCsG3q4xuzcex4d2qpZclQ11A0UwLIPDYYn6bKD0PZ TYImxYBcG3E8CM+XQDPQlFINQQ== X-Google-Smtp-Source: ABdhPJxSlCwTRUQmx67pa1gZHKCpfkm3nLemXTy2O6sJubaAib3q17L4JNf0EIk2EGZEgdaUsbb5sQ== X-Received: by 2002:a63:6c09:: with SMTP id h9mr19629405pgc.214.1604472533444; Tue, 03 Nov 2020 22:48:53 -0800 (PST) Received: from hermes.corp.microsoft.com (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id c12sm1144137pgi.14.2020.11.03.22.48.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Nov 2020 22:48:52 -0800 (PST) From: Stephen Hemminger To: nhorman@tuxdriver.com Cc: dev@dpdk.org, Stephen Hemminger Date: Tue, 3 Nov 2020 22:48:37 -0800 Message-Id: <20201104064842.25832-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201104064842.25832-1-stephen@networkplumber.org> References: <20200906013133.26360-3-stephen@networkplumber.org> <20201104064842.25832-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH v2 2/7] dpdk-pmdinfo: replace io.open with open X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The builtin open() is the recommended approach in python3. io.open was for compatiablity with older versions. Signed-off-by: Stephen Hemminger --- usertools/dpdk-pmdinfo.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/usertools/dpdk-pmdinfo.py b/usertools/dpdk-pmdinfo.py index 7576a3313f36..4fefdc83e583 100755 --- a/usertools/dpdk-pmdinfo.py +++ b/usertools/dpdk-pmdinfo.py @@ -8,7 +8,6 @@ # # ------------------------------------------------------------------------- import json -import io import os import platform import sys @@ -211,7 +210,7 @@ def readLocal(self, filename): """ Reads the local file """ - with io.open(filename, 'r', encoding='utf-8') as f: + with open(filename, 'r', encoding='utf-8') as f: self.contents = f.readlines() self.date = self.findDate(self.contents) @@ -380,7 +379,7 @@ def search_for_autoload_path(self): return (None, None) if raw_output is False: print("Scanning for autoload path in %s" % library) - scanfile = io.open(library, 'rb') + scanfile = open(library, 'rb') scanelf = ReadElf(scanfile, sys.stdout) except AttributeError: # Not a dynamic binary @@ -456,7 +455,7 @@ def process_dt_needed_entries(self): if library is not None: if raw_output is False: print("Scanning %s for pmd information" % library) - with io.open(library, 'rb') as file: + with open(library, 'rb') as file: try: libelf = ReadElf(file, sys.stdout) except ELFError: @@ -499,7 +498,7 @@ def scan_autoload_path(autoload_path): scan_autoload_path(dpath) if os.path.isfile(dpath): try: - file = io.open(dpath, 'rb') + file = open(dpath, 'rb') readelf = ReadElf(file, sys.stdout) except ELFError: # this is likely not an elf file, skip it @@ -526,7 +525,7 @@ def scan_for_autoload_pmds(dpdk_path): print("Must specify a file name") return - file = io.open(dpdk_path, 'rb') + file = open(dpdk_path, 'rb') try: readelf = ReadElf(file, sys.stdout) except ElfError: @@ -621,7 +620,7 @@ def main(stream=None): print("File not found") sys.exit(1) - with io.open(myelffile, 'rb') as file: + with open(myelffile, 'rb') as file: try: readelf = ReadElf(file, sys.stdout) readelf.process_dt_needed_entries()