diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-05-18 21:57:23 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-02 08:24:01 +0100 |
commit | 3ee70cb7259aad3b53e51884ec5b9122e804d77e (patch) | |
tree | fe11513a46170019cdd674002c6cc5b2045b762a /scripts/lib/recipetool/append.py | |
parent | ed7abe6b9a2ff81d320e7c63841487d37e61b5a5 (diff) | |
download | poky-3ee70cb7259aad3b53e51884ec5b9122e804d77e.tar.gz |
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 <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/recipetool/append.py')
-rw-r--r-- | scripts/lib/recipetool/append.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/lib/recipetool/append.py b/scripts/lib/recipetool/append.py index 35756b08af..5d73d307e0 100644 --- a/scripts/lib/recipetool/append.py +++ b/scripts/lib/recipetool/append.py | |||
@@ -90,7 +90,7 @@ def find_target_file(targetpath, d, pkglist=None): | |||
90 | if fnmatch.fnmatchcase(fullpth, targetpath): | 90 | if fnmatch.fnmatchcase(fullpth, targetpath): |
91 | recipes[targetpath].append(pn) | 91 | recipes[targetpath].append(pn) |
92 | elif line.startswith('pkg_preinst_') or line.startswith('pkg_postinst_'): | 92 | elif line.startswith('pkg_preinst_') or line.startswith('pkg_postinst_'): |
93 | scriptval = line.split(':', 1)[1].strip().decode('string_escape') | 93 | scriptval = line.split(':', 1)[1].strip().encode('utf-8').decode('unicode_escape') |
94 | if 'update-alternatives --install %s ' % targetpath in scriptval: | 94 | if 'update-alternatives --install %s ' % targetpath in scriptval: |
95 | recipes[targetpath].append('?%s' % pn) | 95 | recipes[targetpath].append('?%s' % pn) |
96 | elif targetpath_re.search(scriptval): | 96 | elif targetpath_re.search(scriptval): |
@@ -172,7 +172,7 @@ def get_source_path(cmdelements): | |||
172 | """Find the source path specified within a command""" | 172 | """Find the source path specified within a command""" |
173 | command = cmdelements[0] | 173 | command = cmdelements[0] |
174 | if command in ['install', 'cp']: | 174 | if command in ['install', 'cp']: |
175 | helptext = subprocess.check_output('LC_ALL=C %s --help' % command, shell=True) | 175 | helptext = subprocess.check_output('LC_ALL=C %s --help' % command, shell=True).decode('utf-8') |
176 | argopts = '' | 176 | argopts = '' |
177 | argopt_line_re = re.compile('^-([a-zA-Z0-9]), --[a-z-]+=') | 177 | argopt_line_re = re.compile('^-([a-zA-Z0-9]), --[a-z-]+=') |
178 | for line in helptext.splitlines(): | 178 | for line in helptext.splitlines(): |