]> code.ossystems Code Review - openembedded-core.git/commitdiff
recipetool: fix encoding-related errors creating python recipes
authorPaul Eggleton <paul.eggleton@linux.intel.com>
Sun, 4 Dec 2016 22:11:44 +0000 (11:11 +1300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 8 Dec 2016 10:26:12 +0000 (10:26 +0000)
Yet another instance of us expecting a string back from subprocess when
in Python 3 what you get back is bytes. Just decode the output within
run_command() so we avoid this everywhere.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/lib/recipetool/create_buildsys_python.py

index e41d81a317bb64d8e3445685dd32f8bde8974d4e..82a2be1224f0ff0a1a6f23f83df435b255c382b2 100644 (file)
@@ -512,7 +512,7 @@ class PythonRecipeHandler(RecipeHandler):
         except (OSError, subprocess.CalledProcessError):
             pass
         else:
-            for line in dep_output.decode('utf-8').splitlines():
+            for line in dep_output.splitlines():
                 line = line.rstrip()
                 dep, filename = line.split('\t', 1)
                 if filename.endswith('/setup.py'):
@@ -591,7 +591,7 @@ class PythonRecipeHandler(RecipeHandler):
         if 'stderr' not in popenargs:
             popenargs['stderr'] = subprocess.STDOUT
         try:
-            return subprocess.check_output(cmd, **popenargs)
+            return subprocess.check_output(cmd, **popenargs).decode('utf-8')
         except OSError as exc:
             logger.error('Unable to run `{}`: {}', ' '.join(cmd), exc)
             raise