From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id CD077A00C4; Thu, 4 Jun 2020 18:25:20 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6D6C01D5C7; Thu, 4 Jun 2020 18:25:20 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 4A9EA1D5AA for ; Thu, 4 Jun 2020 18:25:18 +0200 (CEST) IronPort-SDR: kS73t8+y7aI93mYHnqyVwOMxDkM1dr98b3Y2fd3thYDP83VnSnB9u01jurb3RjdDv8e/BLbNph Fyqc70L0tg8g== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jun 2020 09:25:17 -0700 IronPort-SDR: LPyu5X/DsHCjEfp1ryIsYx2eHmc4R/koCvHnRgv3JUYTmaLlQqEivtM84OVkTZ2e5gbgV7RYav Z1QTntVT1TVw== X-IronPort-AV: E=Sophos;i="5.73,472,1583222400"; d="scan'208";a="416966791" Received: from bricha3-mobl.ger.corp.intel.com ([10.252.25.230]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-SHA; 04 Jun 2020 09:25:15 -0700 Date: Thu, 4 Jun 2020 17:25:12 +0100 From: Bruce Richardson To: Christian Ehrhardt Cc: dev , Luca Boccassi Message-ID: <20200604162512.GC1543@bricha3-MOBL.ger.corp.intel.com> References: <20200507072629.2374881-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200507072629.2374881-1-christian.ehrhardt@canonical.com> Subject: Re: [dpdk-dev] [PATCH] autotest: fix for pure python3 environments 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" On Thu, May 07, 2020 at 09:26:29AM +0200, Christian Ehrhardt wrote: > Without this fix in a pure python3 environment this will run into > issues like: > ModuleNotFoundError: No module named 'StringIO' > or later string encoding issues on check_output. > > Signed-off-by: Christian Ehrhardt > --- > app/test/autotest_runner.py | 16 +++++++--------- > 1 file changed, 7 insertions(+), 9 deletions(-) > > diff --git a/app/test/autotest_runner.py b/app/test/autotest_runner.py > index 95e74c760d..dfa5f2b2dd 100644 > --- a/app/test/autotest_runner.py > +++ b/app/test/autotest_runner.py > @@ -4,7 +4,7 @@ > # The main logic behind running autotests in parallel > > from __future__ import print_function > -import StringIO > +import io > import csv > from multiprocessing import Pool, Queue > import pexpect > @@ -45,11 +45,9 @@ def get_numa_nodes(): > def first_cpu_on_node(node_nr): > cpu_path = glob.glob("/sys/devices/system/node/node%d/cpu*" % node_nr) > r = re.compile(r"cpu(\d+)") > - cpu_name = filter(None, > - map(r.match, > - map(os.path.basename, cpu_path) > - ) > - ) > + cpu_name = [_f for _f in map(r.match, > + list(map(os.path.basename, cpu_path)) > + ) if _f] > # for compatibility between python 3 and 2 we need to make interable out > # of filter return as it returns list in python 2 and a generator in 3 > m = next(iter(cpu_name)) If this is python3 only, then you can remove the "iter()" call above and the comment about the python2 compatibility. /Bruce