[oe-commits] [openembedded-core] 08/12: meta: py3 fixes

git at git.openembedded.org git at git.openembedded.org
Wed May 11 09:40:47 UTC 2016


rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 982b3fd1a511f6cec4308f392fb154296f728e95
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Wed May 11 10:29:17 2016 +0100

    meta: py3 fixes
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/lib/oeqa/utils/commands.py |  6 +++---
 scripts/oe-selftest             | 10 ++++++----
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 48f6441..18fe39e 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -41,7 +41,7 @@ class Command(object):
         self.data = data
 
         self.options = dict(self.defaultopts)
-        if isinstance(self.cmd, basestring):
+        if isinstance(self.cmd, str):
             self.options["shell"] = True
         if self.data:
             self.options['stdin'] = subprocess.PIPE
@@ -78,7 +78,7 @@ class Command(object):
                 self.process.kill()
                 self.thread.join()
 
-        self.output = self.output.rstrip()
+        self.output = self.output.decode("utf-8").rstrip()
         self.status = self.process.poll()
 
         self.log.debug("Command '%s' returned %d as exit code." % (self.cmd, self.status))
@@ -123,7 +123,7 @@ def bitbake(command, ignore_status=False, timeout=None, postconfig=None, **optio
     else:
         extra_args = ""
 
-    if isinstance(command, basestring):
+    if isinstance(command, str):
         cmd = "bitbake " + extra_args + " " + command
     else:
         cmd = [ "bitbake" ] + [a for a in (command + extra_args.split(" ")) if a not in [""]]
diff --git a/scripts/oe-selftest b/scripts/oe-selftest
index f621fd7..6422505 100755
--- a/scripts/oe-selftest
+++ b/scripts/oe-selftest
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
 
 # Copyright (c) 2013 Intel Corporation
 #
@@ -34,6 +34,8 @@ import subprocess
 import time as t
 import re
 import fnmatch
+import collections
+import imp
 
 sys.path.insert(0, os.path.dirname(os.path.realpath(__file__)) + '/lib')
 import scriptpath
@@ -211,7 +213,7 @@ def get_tests_from_module(tmod):
     try:
         import importlib
         modlib = importlib.import_module(tmod)
-        for mod in vars(modlib).values():
+        for mod in list(vars(modlib).values()):
             if isinstance(mod, type(oeSelfTest)) and issubclass(mod, oeSelfTest) and mod is not oeSelfTest:
                 for test in dir(mod):
                     if test.startswith('test_') and hasattr(vars(mod)[test], '__call__'):
@@ -415,7 +417,7 @@ def coverage_report():
         # Coverage under version 4 uses coverage.coverage
         from coverage import coverage as Coverage
 
-    import cStringIO as StringIO
+    import io as StringIO
     from coverage.misc import CoverageException
 
     cov_output = StringIO.StringIO()
@@ -492,7 +494,7 @@ def main():
                         if isinstance(t, type(oeSelfTest)) and issubclass(t, oeSelfTest) and t!=oeSelfTest:
                             print(" --", v)
                             for method in dir(t):
-                                if method.startswith("test_") and callable(vars(t)[method]):
+                                if method.startswith("test_") and isinstance(vars(t)[method], collections.Callable):
                                     print(" --  --", method)
 
                 except (AttributeError, ImportError) as e:

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


More information about the Openembedded-commits mailing list