From patchwork Sun Sep 6 01:31:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 76616 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 3E3A3A04C5; Sun, 6 Sep 2020 03:32:15 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 69A1D1C10C; Sun, 6 Sep 2020 03:31:49 +0200 (CEST) Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by dpdk.org (Postfix) with ESMTP id CEB1A1C0CA for ; Sun, 6 Sep 2020 03:31:45 +0200 (CEST) Received: by mail-pg1-f179.google.com with SMTP id m5so6280424pgj.9 for ; Sat, 05 Sep 2020 18:31:45 -0700 (PDT) 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=LWDvE3eI9OcLtgssGHw6CClClW/TshHk+vY6RT23qFKXCi6H7S2mZswln5fZOfNHZV EkRr9jFRAtGQrCxLY2eVoR+IZHVaow3rpsRUf6qN+Hk81yLF1aGUBrk8MmiWhAawO74K MvEGJdZsbShe96OdKhHDI/duvAj8k2e48hSD1c1xQGrs+o+ERPxA9iB8soZPgkvxSmZC G0WSLeOS19+lAYUbaf089DtdRNGMmRoawn1OdVnAIPO5M1sZlUoYRJXMnFTqziaIWFw6 WBLBVCIHtVN+F4pPReYWwT+7X1AV3NXATpS+VmxfBZEoUeJDfLglfFmE2jsYnh9FnU70 3T3A== 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=JDdXtVIzZTZyXsPt1MJSzQGISf+4XnBLNAYpRA5HCszx02An9doHB5ixB62UlYYrR5 v/3oN/iCV3xotquABo9QB1PFHr9OHfN/e4icpthSu9d6ah8FpHMwHjqD3OjmOJJuOLDv R8DkzCMFFlFDd/d55L9ZP6tg5PK03TEmgo+Jg+bPDYWcwdLVAgczNdgiM/0jhGtjMOPU Fi85JJxwC0TFMsqmibbU1wN8+kWGjq2lMQTuthOmKjbtVsD4MjF/2mFWMH4POQmroFkz 5ORZHJjrhqqVPrraeFlwXM/nglc/4sYAe6KyOWlIgkkXqHWam0CPkTfpO/0oufTJdMLL oXkw== X-Gm-Message-State: AOAM533FSE0HBuEYku9LIMScNwfdvpwGYPAVUXE5Hx/z9kho9VkYiRiE 7oDgSIiPfiW7pmsVh4sFGKx4TvkLmH6Q5Q== X-Google-Smtp-Source: ABdhPJyEGqVEBpxNKAm8DR7cn7OxTaDM5uVt/VnV0GLopb2tDovsg+LnvN8lF+kVjQjedqAESpuFCA== X-Received: by 2002:a65:6897:: with SMTP id e23mr12498606pgt.103.1599355904709; Sat, 05 Sep 2020 18:31:44 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id n127sm10731863pfn.155.2020.09.05.18.31.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Sep 2020 18:31:44 -0700 (PDT) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Sat, 5 Sep 2020 18:31:25 -0700 Message-Id: <20200906013133.26360-4-stephen@networkplumber.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200906013133.26360-1-stephen@networkplumber.org> References: <20200906013133.26360-1-stephen@networkplumber.org> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 03/11] 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()