All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Cc: dev <dev@dpdk.org>, Luca Boccassi <bluca@debian.org>
Subject: Re: [dpdk-dev] [PATCH] autotest: fix for pure python3 environments
Date: Thu, 4 Jun 2020 17:25:12 +0100	[thread overview]
Message-ID: <20200604162512.GC1543@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <20200507072629.2374881-1-christian.ehrhardt@canonical.com>

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 <christian.ehrhardt@canonical.com>
> ---
>  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

      parent reply	other threads:[~2020-06-04 16:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07  7:26 [dpdk-dev] [PATCH] autotest: fix for pure python3 environments Christian Ehrhardt
2020-05-07  9:36 ` Luca Boccassi
2020-05-07 11:25   ` Bruce Richardson
2020-06-04 14:43     ` Christian Ehrhardt
2020-06-04 16:22       ` Bruce Richardson
2020-05-07  9:43 ` Robin Jarry
2020-06-04 16:25 ` Bruce Richardson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200604162512.GC1543@bricha3-MOBL.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=bluca@debian.org \
    --cc=christian.ehrhardt@canonical.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.