All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] utils/genrandconfig: fix runtime issue with Python 3
Date: Tue, 3 Dec 2019 23:01:22 +0100	[thread overview]
Message-ID: <2384d6b2-cf52-27d7-59bd-843273c3ddca@mind.be> (raw)
In-Reply-To: <20191203165137.1100010-1-thomas.petazzoni@bootlin.com>



On 03/12/2019 17:51, Thomas Petazzoni wrote:
> With Python 3.7, genrandconfig fails with:
> 
> 'str' object has no attribute 'decode'
> 
> We are already working on str objects, and there is no need to decode
> them, so we drop the call to decode_byte_list() and its definition as
> it was only used there.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

 Applied to master, thanks.

 Regards,
 Arnout

> ---
> This is of course very strange, as the decode_byte_list() function was
> introduced specifically to handle Python 3.x. Does anyone has an
> explanation?
> ---
>  utils/genrandconfig | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/utils/genrandconfig b/utils/genrandconfig
> index fb28f4d356..5b60bc21d6 100755
> --- a/utils/genrandconfig
> +++ b/utils/genrandconfig
> @@ -39,14 +39,6 @@ def urlopen_closing(uri):
>      return contextlib.closing(_urllib.urlopen(uri))
>  
>  
> -if sys.hexversion >= 0x3000000:
> -    def decode_byte_list(bl):
> -        return [b.decode() for b in bl]
> -else:
> -    def decode_byte_list(e):
> -        return e
> -
> -
>  class SystemInfo:
>      DEFAULT_NEEDED_PROGS = ["make", "git", "gcc", "timeout"]
>      DEFAULT_OPTIONAL_PROGS = ["bzr", "java", "javac", "jar", "diffoscope"]
> @@ -128,7 +120,7 @@ def get_toolchain_configs(toolchains_csv, buildrootdir):
>      with open(toolchains_csv) as r:
>          # filter empty lines and comments
>          lines = [t for t in r.readlines() if len(t.strip()) > 0 and t[0] != '#']
> -        toolchains = decode_byte_list(lines)
> +        toolchains = lines
>      configs = []
>  
>      (_, _, _, _, hostarch) = os.uname()
> 

  parent reply	other threads:[~2019-12-03 22:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03 16:51 [Buildroot] [PATCH] utils/genrandconfig: fix runtime issue with Python 3 Thomas Petazzoni
2019-12-03 19:36 ` Arnout Vandecappelle
2019-12-03 19:58   ` Thomas Petazzoni
2019-12-04 12:52     ` Arnout Vandecappelle
2019-12-04 12:58       ` Thomas Petazzoni
2019-12-03 22:01 ` Arnout Vandecappelle [this message]
2019-12-06  8:53 ` Peter Korsgaard
2019-12-06  9:00 ` Peter Korsgaard

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=2384d6b2-cf52-27d7-59bd-843273c3ddca@mind.be \
    --to=arnout@mind.be \
    --cc=buildroot@busybox.net \
    /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.