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 95794A00C5; Thu, 7 May 2020 11:43:44 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id BC8781DB35; Thu, 7 May 2020 11:43:43 +0200 (CEST) Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by dpdk.org (Postfix) with ESMTP id 1F1121DB2F for ; Thu, 7 May 2020 11:43:42 +0200 (CEST) Received: by mail-wr1-f67.google.com with SMTP id j5so5552506wrq.2 for ; Thu, 07 May 2020 02:43:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=v1uVjpNz3wjh+MVm5u1qJM4oMAXnCWnE1OPwFkBwlGY=; b=SMqx6vxt+/QnjhQ+lB1UtOVVpykXjdjR0xx4T7LXzguMBeQOuxkyYTiFEQoD6yys4x yTP6f9nKWYwMTxeQekmP1MO7eP1swUUl1gOwam+TgoGvIjiEdtFl09w3FntdfHqfkm3P 73W1zdO21plkiJx4om0+hlD5aSHWh3+Nq1veaGX+8FFCf+rtFRGgLPl4gcbwu13L8YZp t7vZOmoLYrkpeLU7e5IfJjoOfRkEhBHdkuy1gURvrVooRlYC51ajigDhL65Bu1K9RPle rqd3R/vHEAZr/TG/7Rwam2nlROi7bSwhLQnT4ZpiEcep8De9atAly4tCTaXNWxCVtJ/F xFvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=v1uVjpNz3wjh+MVm5u1qJM4oMAXnCWnE1OPwFkBwlGY=; b=k73aHUKftqXVpPZvlNCgfSPs7V5u7al6Cwp7aEqbI8oPk6Qrm98Hq3TRpCPLTjpH0U V5S2+3PtJ2wcVrusgCzdiyMQ+0rUqm/xvSz82JBkhVFGVF+IufSnqLF+w/Q+lckctTNa 49Wa44ccUnyRW53oE1APVt1UtFwZop5iIuI1AWn1+fgpDakpxNBTXhNExfBCgV99ErwD M+90O/InAJ/03K4FOuseRPoefnUiaHX8mBki4x66sufxJZeJMXhkZqPKji4J7g1FTiPS aCRXnkEzjyk0jpNFiDFOBe7iXzOA2wsJY+z4iBbU4lyrhkQ1MeC4EbAhA9yURo+HeZ8t 2bww== X-Gm-Message-State: AGi0PuZSRuwwADzy71uvQ1uVPWdzYNv1rRaqiQZicfChB3B0/Kayw8l2 iHkVBmwq/PjIIdCgVbkEWIUyUA== X-Google-Smtp-Source: APiQypKHqq0LV/zY48Mmy781FWRDTbSZ5MgAnG0CDchIG1Nsk8ODdllb6PwZaBBg5JUOs1XaeSzMoA== X-Received: by 2002:a05:6000:12cf:: with SMTP id l15mr14070295wrx.348.1588844621827; Thu, 07 May 2020 02:43:41 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id x5sm6818063wro.12.2020.05.07.02.43.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2020 02:43:41 -0700 (PDT) Date: Thu, 7 May 2020 11:43:40 +0200 From: Robin Jarry To: Christian Ehrhardt Cc: dev , Luca Boccassi Message-ID: <20200507094340.tgateryj43vdelwz@6wind.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> User-Agent: NeoMutt/20180716 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" Hi Christian, 2020-05-07, Christian Ehrhardt: > 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 > @@ -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] Since filter() is not available on Python 3, maybe this function could be made a little simpler: def first_cpu_on_node(node_nr): for fname in os.listdir("/sys/devices/system/node/node%d" % node_nr): match = re.match(r"cpu(\d+)", fname) if match: return int(match.group(1)) raise ValueError("no cpu on node %d" % node_nr) The rest looks good to me. -- Robin