[oe-commits] [bitbake] 14/22: toaster: use decode('utf-8') for binary data

git at git.openembedded.org git at git.openembedded.org
Fri May 13 13:26:58 UTC 2016


rpurdie pushed a commit to branch python3
in repository bitbake.

commit 85d2db23dbed275e4c9ed3fecd952f55a73faee1
Author: Ed Bartosh <ed.bartosh at linux.intel.com>
AuthorDate: Tue May 10 15:28:50 2016 +0300

    toaster: use decode('utf-8') for binary data
    
    Decoded binary data to utf-8 to fix the following
    error when runnign on python 3:
    TypeError: Type str doesn't support the buffer API
    
    [YOCTO #9584]
    
    Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/toaster/bldcontrol/localhostbecontroller.py        | 2 +-
 lib/toaster/bldcontrol/management/commands/loadconf.py | 2 +-
 lib/toaster/orm/models.py                              | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/toaster/bldcontrol/localhostbecontroller.py b/lib/toaster/bldcontrol/localhostbecontroller.py
index b4e4196..3da8be4 100644
--- a/lib/toaster/bldcontrol/localhostbecontroller.py
+++ b/lib/toaster/bldcontrol/localhostbecontroller.py
@@ -70,7 +70,7 @@ class LocalhostBEController(BuildEnvironmentController):
             raise ShellCmdException(err)
         else:
             logger.debug("localhostbecontroller: shellcmd success")
-            return out
+            return out.decode('utf-8')
 
     def getGitCloneDirectory(self, url, branch):
         """Construct unique clone directory name out of url and branch."""
diff --git a/lib/toaster/bldcontrol/management/commands/loadconf.py b/lib/toaster/bldcontrol/management/commands/loadconf.py
index 6d25df9..173e3ce 100644
--- a/lib/toaster/bldcontrol/management/commands/loadconf.py
+++ b/lib/toaster/bldcontrol/management/commands/loadconf.py
@@ -54,7 +54,7 @@ class Command(BaseCommand):
             (out,err) = cmd.communicate()
             if cmd.returncode != 0:
                 logging.warning("Error while importing layer vcs_url: git error: %s" % err)
-            for line in out.split("\n"):
+            for line in out.decode('utf-8').split("\n"):
                 try:
                     (name, path) = line.split("\t", 1)
                     if name == remote_name:
diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index 95a3dc7..8c383c8 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -1168,7 +1168,7 @@ class LayerIndexLayerSource(LayerSource):
             except URLError as e:
                 raise Exception("Failed to read %s: %s" % (path, e.reason))
 
-            return json.loads(res.read())
+            return json.loads(res.read().decode('utf-8'))
 
         # verify we can get the basic api
         try:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list