[U-Boot] [PATCH v2 05/10] patman: Decode stdout/stderr as utf8, be python 3.x safe
Simon Glass
sjg at chromium.org
Thu Oct 6 04:01:00 CEST 2016
Hi Paul,
On 27 September 2016 at 09:03, Paul Burton <paul.burton at imgtec.com> wrote:
> In python 3.x reading stdout or stdin will produce a bytestring rather
> than a string. Decode it in CommunicateFilter such that the rest of the
> code can continue to deal with strings. This works fine with python 2.x
> too.
>
> Signed-off-by: Paul Burton <paul.burton at imgtec.com>
> Acked-by: Simon Glass <sjg at chromium.org>
> ---
>
> Changes in v2: None
>
> tools/patman/cros_subprocess.py | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/patman/cros_subprocess.py b/tools/patman/cros_subprocess.py
> index ebd4300..922e560 100644
> --- a/tools/patman/cros_subprocess.py
> +++ b/tools/patman/cros_subprocess.py
> @@ -189,7 +189,7 @@ class Popen(subprocess.Popen):
> data = ""
> # We will get an error on read if the pty is closed
> try:
> - data = os.read(self.stdout.fileno(), 1024)
> + data = os.read(self.stdout.fileno(), 1024).decode('utf8')
> except OSError:
> pass
> if data == "":
> @@ -204,7 +204,7 @@ class Popen(subprocess.Popen):
> data = ""
> # We will get an error on read if the pty is closed
> try:
> - data = os.read(self.stderr.fileno(), 1024)
> + data = os.read(self.stderr.fileno(), 1024).decode('utf8')
> except OSError:
> pass
> if data == "":
> --
> 2.10.0
>
Unfortunately this causes an error:
$ buildman -b dm-push sandbox
boards.cfg is up to date. Nothing to do.
Building 16 commits for 3 boards (3 threads, 3 jobs per thread)
Traceback (most recent call last):
File "/home/sglass/bin/buildman", line 64, in <module>
ret_code = control.DoBuildman(options, args)
File "/scratch/sglass/cosarm/src/third_party/u-boot/files/tools/buildman/control.py",
line 300, in DoBuildman
options.keep_outputs, options.verbose)
File "/scratch/sglass/cosarm/src/third_party/u-boot/files/tools/buildman/builder.py",
line 1433, in BuildBoards
self._PrepareOutputSpace()
File "/scratch/sglass/cosarm/src/third_party/u-boot/files/tools/buildman/builder.py",
line 1399, in _PrepareOutputSpace
dir_list.append(self._GetOutputDir(commit_upto))
File "/scratch/sglass/cosarm/src/third_party/u-boot/files/tools/buildman/builder.py",
line 449, in _GetOutputDir
subject = commit.subject.translate(trans_valid_chars)
TypeError: character mapping must return integer, None or unicode
Regards,
Simon
More information about the U-Boot
mailing list