From 3ee70cb7259aad3b53e51884ec5b9122e804d77e Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Wed, 18 May 2016 21:57:23 +0300 Subject: scripts: Fix encoding errors for python3 Moved call of decode('utf-8') as close as possible to call of subprocess API to avoid calling it in a lot of other places. Decoded binary data to utf-8 where appropriate to fix devtool and recipetool tests in python 3 environment. (From OE-Core rev: 30d02e2aa2d42fdf76271234b2dc9f37bc46b250) Signed-off-by: Ed Bartosh Signed-off-by: Richard Purdie --- meta/lib/oe/patch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'meta') diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py index a25fd527f6..4a0d3f7149 100644 --- a/meta/lib/oe/patch.py +++ b/meta/lib/oe/patch.py @@ -292,7 +292,10 @@ class GitApplyTree(PatchTree): def decodeAuthor(line): from email.header import decode_header authorval = line.split(':', 1)[1].strip().replace('"', '') - return decode_header(authorval)[0][0] + result = decode_header(authorval)[0][0] + if hasattr(result, 'decode'): + result = result.decode('utf-8') + return result @staticmethod def interpretPatchHeader(headerlines): -- cgit v1.2.3-54-g00ecf