summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/base.bbclass2
-rw-r--r--meta/classes/buildhistory.bbclass2
-rw-r--r--meta/classes/populate_sdk_ext.bbclass4
-rw-r--r--meta/classes/report-error.bbclass2
-rw-r--r--meta/lib/oe/classutils.py15
-rw-r--r--meta/lib/oe/distro_check.py4
-rw-r--r--meta/lib/oe/maketype.py9
-rw-r--r--meta/lib/oe/manifest.py3
-rw-r--r--meta/lib/oe/package.py2
-rw-r--r--meta/lib/oe/package_manager.py11
-rw-r--r--meta/lib/oe/qa.py28
-rw-r--r--meta/lib/oe/recipeutils.py4
-rw-r--r--meta/lib/oe/rootfs.py3
-rw-r--r--meta/lib/oe/sdk.py4
-rw-r--r--meta/lib/oe/terminal.py6
-rw-r--r--meta/lib/oe/tests/test_path.py2
-rw-r--r--meta/lib/oe/types.py4
-rw-r--r--meta/lib/oe/utils.py6
-rw-r--r--meta/lib/oeqa/controllers/masterimage.py4
-rw-r--r--meta/lib/oeqa/oetest.py10
-rw-r--r--meta/lib/oeqa/selftest/_toaster.py4
-rw-r--r--meta/lib/oeqa/selftest/recipetool.py4
-rw-r--r--meta/lib/oeqa/selftest/sstatetests.py6
-rw-r--r--meta/lib/oeqa/targetcontrol.py4
-rw-r--r--meta/lib/oeqa/utils/commands.py4
-rw-r--r--meta/lib/oeqa/utils/decorators.py17
-rw-r--r--meta/lib/oeqa/utils/dump.py2
-rw-r--r--meta/lib/oeqa/utils/httpserver.py6
-rw-r--r--meta/lib/oeqa/utils/logparser.py2
-rw-r--r--meta/lib/oeqa/utils/qemurunner.py22
-rw-r--r--meta/lib/oeqa/utils/qemutinyrunner.py2
-rw-r--r--meta/lib/oeqa/utils/targetbuild.py4
-rw-r--r--meta/lib/oeqa/utils/testexport.py2
33 files changed, 108 insertions, 96 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index 4be0a7e487..357062b3c1 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -10,7 +10,7 @@ inherit utility-tasks
10inherit metadata_scm 10inherit metadata_scm
11inherit logging 11inherit logging
12 12
13OE_IMPORTS += "os sys time oe.path oe.utils oe.data oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath" 13OE_IMPORTS += "os sys time oe.path oe.utils oe.types oe.package oe.packagegroup oe.sstatesig oe.lsb oe.cachedpath"
14OE_IMPORTS[type] = "list" 14OE_IMPORTS[type] = "list"
15 15
16def oe_import(d): 16def oe_import(d):
diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 1ccd9ee485..6995d06950 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -145,7 +145,7 @@ python buildhistory_emit_pkghistory() {
145 elif name == "RCONFLICTS": 145 elif name == "RCONFLICTS":
146 pkginfo.rconflicts = value 146 pkginfo.rconflicts = value
147 elif name == "PKGSIZE": 147 elif name == "PKGSIZE":
148 pkginfo.size = long(value) 148 pkginfo.size = int(value)
149 elif name == "FILES": 149 elif name == "FILES":
150 pkginfo.files = value 150 pkginfo.files = value
151 elif name == "FILELIST": 151 elif name == "FILELIST":
diff --git a/meta/classes/populate_sdk_ext.bbclass b/meta/classes/populate_sdk_ext.bbclass
index a9c6fe5933..b9d9543409 100644
--- a/meta/classes/populate_sdk_ext.bbclass
+++ b/meta/classes/populate_sdk_ext.bbclass
@@ -129,8 +129,8 @@ python copy_buildsystem () {
129 d.setVar('scriptrelpath', scriptrelpath) 129 d.setVar('scriptrelpath', scriptrelpath)
130 130
131 # Write out config file for devtool 131 # Write out config file for devtool
132 import ConfigParser 132 import configparser
133 config = ConfigParser.SafeConfigParser() 133 config = configparser.SafeConfigParser()
134 config.add_section('General') 134 config.add_section('General')
135 config.set('General', 'bitbake_subdir', conf_bbpath) 135 config.set('General', 'bitbake_subdir', conf_bbpath)
136 config.set('General', 'init_path', conf_initpath) 136 config.set('General', 'init_path', conf_initpath)
diff --git a/meta/classes/report-error.bbclass b/meta/classes/report-error.bbclass
index 20d2bef797..5cbf8f07fd 100644
--- a/meta/classes/report-error.bbclass
+++ b/meta/classes/report-error.bbclass
@@ -43,7 +43,7 @@ python errorreport_handler () {
43 data['target_sys'] = e.data.getVar("TARGET_SYS", True) 43 data['target_sys'] = e.data.getVar("TARGET_SYS", True)
44 data['failures'] = [] 44 data['failures'] = []
45 data['component'] = e.getPkgs()[0] 45 data['component'] = e.getPkgs()[0]
46 data['branch_commit'] = base_detect_branch(e.data) + ": " + base_detect_revision(e.data) 46 data['branch_commit'] = str(base_detect_branch(e.data)) + ": " + str(base_detect_revision(e.data))
47 lock = bb.utils.lockfile(datafile + '.lock') 47 lock = bb.utils.lockfile(datafile + '.lock')
48 errorreport_savedata(e, data, "error-report.txt") 48 errorreport_savedata(e, data, "error-report.txt")
49 bb.utils.unlockfile(lock) 49 bb.utils.unlockfile(lock)
diff --git a/meta/lib/oe/classutils.py b/meta/lib/oe/classutils.py
index 98bb059a71..e7856c86f2 100644
--- a/meta/lib/oe/classutils.py
+++ b/meta/lib/oe/classutils.py
@@ -1,4 +1,11 @@
1class ClassRegistry(type): 1
2class ClassRegistryMeta(type):
3 """Give each ClassRegistry their own registry"""
4 def __init__(cls, name, bases, attrs):
5 cls.registry = {}
6 type.__init__(cls, name, bases, attrs)
7
8class ClassRegistry(type, metaclass=ClassRegistryMeta):
2 """Maintain a registry of classes, indexed by name. 9 """Maintain a registry of classes, indexed by name.
3 10
4Note that this implementation requires that the names be unique, as it uses 11Note that this implementation requires that the names be unique, as it uses
@@ -12,12 +19,6 @@ Subclasses of ClassRegistry may define an 'implemented' property to exert
12control over whether the class will be added to the registry (e.g. to keep 19control over whether the class will be added to the registry (e.g. to keep
13abstract base classes out of the registry).""" 20abstract base classes out of the registry)."""
14 priority = 0 21 priority = 0
15 class __metaclass__(type):
16 """Give each ClassRegistry their own registry"""
17 def __init__(cls, name, bases, attrs):
18 cls.registry = {}
19 type.__init__(cls, name, bases, attrs)
20
21 def __init__(cls, name, bases, attrs): 22 def __init__(cls, name, bases, attrs):
22 super(ClassRegistry, cls).__init__(name, bases, attrs) 23 super(ClassRegistry, cls).__init__(name, bases, attrs)
23 try: 24 try:
diff --git a/meta/lib/oe/distro_check.py b/meta/lib/oe/distro_check.py
index ba1bba678d..746e242f5d 100644
--- a/meta/lib/oe/distro_check.py
+++ b/meta/lib/oe/distro_check.py
@@ -1,8 +1,8 @@
1from contextlib import contextmanager 1from contextlib import contextmanager
2@contextmanager 2@contextmanager
3def create_socket(url, d): 3def create_socket(url, d):
4 import urllib 4 import urllib.request, urllib.parse, urllib.error
5 socket = urllib.urlopen(url, proxies=get_proxies(d)) 5 socket = urllib.request.urlopen(url, proxies=get_proxies(d))
6 try: 6 try:
7 yield socket 7 yield socket
8 finally: 8 finally:
diff --git a/meta/lib/oe/maketype.py b/meta/lib/oe/maketype.py
index 139f333691..f88981dd90 100644
--- a/meta/lib/oe/maketype.py
+++ b/meta/lib/oe/maketype.py
@@ -6,7 +6,8 @@ the arguments of the type's factory for details.
6""" 6"""
7 7
8import inspect 8import inspect
9import types 9import oe.types as types
10import collections
10 11
11available_types = {} 12available_types = {}
12 13
@@ -53,7 +54,9 @@ def get_callable_args(obj):
53 if type(obj) is type: 54 if type(obj) is type:
54 obj = obj.__init__ 55 obj = obj.__init__
55 56
56 args, varargs, keywords, defaults = inspect.getargspec(obj) 57 sig = inspect.signature(obj)
58 args = list(sig.parameters.keys())
59 defaults = list(s for s in sig.parameters.keys() if sig.parameters[s].default != inspect.Parameter.empty)
57 flaglist = [] 60 flaglist = []
58 if args: 61 if args:
59 if len(args) > 1 and args[0] == 'self': 62 if len(args) > 1 and args[0] == 'self':
@@ -93,7 +96,7 @@ for name in dir(types):
93 continue 96 continue
94 97
95 obj = getattr(types, name) 98 obj = getattr(types, name)
96 if not callable(obj): 99 if not isinstance(obj, collections.Callable):
97 continue 100 continue
98 101
99 register(name, obj) 102 register(name, obj)
diff --git a/meta/lib/oe/manifest.py b/meta/lib/oe/manifest.py
index ec2ef500b2..95f8eb2df3 100644
--- a/meta/lib/oe/manifest.py
+++ b/meta/lib/oe/manifest.py
@@ -4,11 +4,10 @@ import re
4import bb 4import bb
5 5
6 6
7class Manifest(object): 7class Manifest(object, metaclass=ABCMeta):
8 """ 8 """
9 This is an abstract class. Do not instantiate this directly. 9 This is an abstract class. Do not instantiate this directly.
10 """ 10 """
11 __metaclass__ = ABCMeta
12 11
13 PKG_TYPE_MUST_INSTALL = "mip" 12 PKG_TYPE_MUST_INSTALL = "mip"
14 PKG_TYPE_MULTILIB = "mlp" 13 PKG_TYPE_MULTILIB = "mlp"
diff --git a/meta/lib/oe/package.py b/meta/lib/oe/package.py
index 5bb15bbc09..faa0ab2edb 100644
--- a/meta/lib/oe/package.py
+++ b/meta/lib/oe/package.py
@@ -8,7 +8,7 @@ def runstrip(arg):
8 # 8 - shared library 8 # 8 - shared library
9 # 16 - kernel module 9 # 16 - kernel module
10 10
11 import commands, stat, subprocess 11 import stat, subprocess
12 12
13 (file, elftype, strip) = arg 13 (file, elftype, strip) = arg
14 14
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 54e6970298..71e5b502e7 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -89,9 +89,7 @@ def opkg_query(cmd_output):
89 return output 89 return output
90 90
91 91
92class Indexer(object): 92class Indexer(object, metaclass=ABCMeta):
93 __metaclass__ = ABCMeta
94
95 def __init__(self, d, deploy_dir): 93 def __init__(self, d, deploy_dir):
96 self.d = d 94 self.d = d
97 self.deploy_dir = deploy_dir 95 self.deploy_dir = deploy_dir
@@ -342,9 +340,7 @@ class DpkgIndexer(Indexer):
342 340
343 341
344 342
345class PkgsList(object): 343class PkgsList(object, metaclass=ABCMeta):
346 __metaclass__ = ABCMeta
347
348 def __init__(self, d, rootfs_dir): 344 def __init__(self, d, rootfs_dir):
349 self.d = d 345 self.d = d
350 self.rootfs_dir = rootfs_dir 346 self.rootfs_dir = rootfs_dir
@@ -512,11 +508,10 @@ class DpkgPkgsList(PkgsList):
512 return opkg_query(cmd_output) 508 return opkg_query(cmd_output)
513 509
514 510
515class PackageManager(object): 511class PackageManager(object, metaclass=ABCMeta):
516 """ 512 """
517 This is an abstract class. Do not instantiate this directly. 513 This is an abstract class. Do not instantiate this directly.
518 """ 514 """
519 __metaclass__ = ABCMeta
520 515
521 def __init__(self, d): 516 def __init__(self, d):
522 self.d = d 517 self.d = d
diff --git a/meta/lib/oe/qa.py b/meta/lib/oe/qa.py
index 2c301419b0..75e7df8546 100644
--- a/meta/lib/oe/qa.py
+++ b/meta/lib/oe/qa.py
@@ -50,41 +50,41 @@ class ELFFile:
50 if len(self.data) < ELFFile.EI_NIDENT + 4: 50 if len(self.data) < ELFFile.EI_NIDENT + 4:
51 raise NotELFFileError("%s is not an ELF" % self.name) 51 raise NotELFFileError("%s is not an ELF" % self.name)
52 52
53 self.my_assert(self.data[0], chr(0x7f) ) 53 self.my_assert(self.data[0], 0x7f)
54 self.my_assert(self.data[1], 'E') 54 self.my_assert(self.data[1], ord('E'))
55 self.my_assert(self.data[2], 'L') 55 self.my_assert(self.data[2], ord('L'))
56 self.my_assert(self.data[3], 'F') 56 self.my_assert(self.data[3], ord('F'))
57 if self.bits == 0: 57 if self.bits == 0:
58 if self.data[ELFFile.EI_CLASS] == chr(ELFFile.ELFCLASS32): 58 if self.data[ELFFile.EI_CLASS] == ELFFile.ELFCLASS32:
59 self.bits = 32 59 self.bits = 32
60 elif self.data[ELFFile.EI_CLASS] == chr(ELFFile.ELFCLASS64): 60 elif self.data[ELFFile.EI_CLASS] == ELFFile.ELFCLASS64:
61 self.bits = 64 61 self.bits = 64
62 else: 62 else:
63 # Not 32-bit or 64.. lets assert 63 # Not 32-bit or 64.. lets assert
64 raise NotELFFileError("ELF but not 32 or 64 bit.") 64 raise NotELFFileError("ELF but not 32 or 64 bit.")
65 elif self.bits == 32: 65 elif self.bits == 32:
66 self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS32)) 66 self.my_assert(self.data[ELFFile.EI_CLASS], ELFFile.ELFCLASS32)
67 elif self.bits == 64: 67 elif self.bits == 64:
68 self.my_assert(self.data[ELFFile.EI_CLASS], chr(ELFFile.ELFCLASS64)) 68 self.my_assert(self.data[ELFFile.EI_CLASS], ELFFile.ELFCLASS64)
69 else: 69 else:
70 raise NotELFFileError("Must specify unknown, 32 or 64 bit size.") 70 raise NotELFFileError("Must specify unknown, 32 or 64 bit size.")
71 self.my_assert(self.data[ELFFile.EI_VERSION], chr(ELFFile.EV_CURRENT) ) 71 self.my_assert(self.data[ELFFile.EI_VERSION], ELFFile.EV_CURRENT)
72 72
73 self.sex = self.data[ELFFile.EI_DATA] 73 self.sex = self.data[ELFFile.EI_DATA]
74 if self.sex == chr(ELFFile.ELFDATANONE): 74 if self.sex == ELFFile.ELFDATANONE:
75 raise NotELFFileError("self.sex == ELFDATANONE") 75 raise NotELFFileError("self.sex == ELFDATANONE")
76 elif self.sex == chr(ELFFile.ELFDATA2LSB): 76 elif self.sex == ELFFile.ELFDATA2LSB:
77 self.sex = "<" 77 self.sex = "<"
78 elif self.sex == chr(ELFFile.ELFDATA2MSB): 78 elif self.sex == ELFFile.ELFDATA2MSB:
79 self.sex = ">" 79 self.sex = ">"
80 else: 80 else:
81 raise NotELFFileError("Unknown self.sex") 81 raise NotELFFileError("Unknown self.sex")
82 82
83 def osAbi(self): 83 def osAbi(self):
84 return ord(self.data[ELFFile.EI_OSABI]) 84 return self.data[ELFFile.EI_OSABI]
85 85
86 def abiVersion(self): 86 def abiVersion(self):
87 return ord(self.data[ELFFile.EI_ABIVERSION]) 87 return self.data[ELFFile.EI_ABIVERSION]
88 88
89 def abiSize(self): 89 def abiSize(self):
90 return self.bits 90 return self.bits
diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py
index 1b8538785c..e3c4b8a759 100644
--- a/meta/lib/oe/recipeutils.py
+++ b/meta/lib/oe/recipeutils.py
@@ -11,7 +11,7 @@ import os.path
11import tempfile 11import tempfile
12import textwrap 12import textwrap
13import difflib 13import difflib
14import utils 14from . import utils
15import shutil 15import shutil
16import re 16import re
17import fnmatch 17import fnmatch
@@ -662,7 +662,7 @@ def bbappend_recipe(rd, destlayerdir, srcfiles, install=None, wildcardver=False,
662 662
663 if removevar in removevalues: 663 if removevar in removevalues:
664 remove = removevalues[removevar] 664 remove = removevalues[removevar]
665 if isinstance(remove, basestring): 665 if isinstance(remove, str):
666 if remove in splitval: 666 if remove in splitval:
667 splitval.remove(remove) 667 splitval.remove(remove)
668 changed = True 668 changed = True
diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py
index d93485819a..1fc35bdc78 100644
--- a/meta/lib/oe/rootfs.py
+++ b/meta/lib/oe/rootfs.py
@@ -10,11 +10,10 @@ import subprocess
10import re 10import re
11 11
12 12
13class Rootfs(object): 13class Rootfs(object, metaclass=ABCMeta):
14 """ 14 """
15 This is an abstract class. Do not instantiate this directly. 15 This is an abstract class. Do not instantiate this directly.
16 """ 16 """
17 __metaclass__ = ABCMeta
18 17
19 def __init__(self, d): 18 def __init__(self, d):
20 self.d = d 19 self.d = d
diff --git a/meta/lib/oe/sdk.py b/meta/lib/oe/sdk.py
index 4786cc5aac..c74525f929 100644
--- a/meta/lib/oe/sdk.py
+++ b/meta/lib/oe/sdk.py
@@ -8,9 +8,7 @@ import glob
8import traceback 8import traceback
9 9
10 10
11class Sdk(object): 11class Sdk(object, metaclass=ABCMeta):
12 __metaclass__ = ABCMeta
13
14 def __init__(self, d, manifest_dir): 12 def __init__(self, d, manifest_dir):
15 self.d = d 13 self.d = d
16 self.sdk_output = self.d.getVar('SDK_OUTPUT', True) 14 self.sdk_output = self.d.getVar('SDK_OUTPUT', True)
diff --git a/meta/lib/oe/terminal.py b/meta/lib/oe/terminal.py
index 634daa9033..dc25d14ff6 100644
--- a/meta/lib/oe/terminal.py
+++ b/meta/lib/oe/terminal.py
@@ -25,9 +25,7 @@ class Registry(oe.classutils.ClassRegistry):
25 return bool(cls.command) 25 return bool(cls.command)
26 26
27 27
28class Terminal(Popen): 28class Terminal(Popen, metaclass=Registry):
29 __metaclass__ = Registry
30
31 def __init__(self, sh_cmd, title=None, env=None, d=None): 29 def __init__(self, sh_cmd, title=None, env=None, d=None):
32 fmt_sh_cmd = self.format_command(sh_cmd, title) 30 fmt_sh_cmd = self.format_command(sh_cmd, title)
33 try: 31 try:
@@ -41,7 +39,7 @@ class Terminal(Popen):
41 39
42 def format_command(self, sh_cmd, title): 40 def format_command(self, sh_cmd, title):
43 fmt = {'title': title or 'Terminal', 'command': sh_cmd} 41 fmt = {'title': title or 'Terminal', 'command': sh_cmd}
44 if isinstance(self.command, basestring): 42 if isinstance(self.command, str):
45 return shlex.split(self.command.format(**fmt)) 43 return shlex.split(self.command.format(**fmt))
46 else: 44 else:
47 return [element.format(**fmt) for element in self.command] 45 return [element.format(**fmt) for element in self.command]
diff --git a/meta/lib/oe/tests/test_path.py b/meta/lib/oe/tests/test_path.py
index 5fa24483d1..44d068143e 100644
--- a/meta/lib/oe/tests/test_path.py
+++ b/meta/lib/oe/tests/test_path.py
@@ -85,5 +85,5 @@ class TestRealPath(unittest.TestCase):
85 85
86 def test_loop(self): 86 def test_loop(self):
87 for e in self.EXCEPTIONS: 87 for e in self.EXCEPTIONS:
88 self.assertRaisesRegexp(OSError, r'\[Errno %u\]' % e[1], 88 self.assertRaisesRegex(OSError, r'\[Errno %u\]' % e[1],
89 self.__realpath, e[0], False, False) 89 self.__realpath, e[0], False, False)
diff --git a/meta/lib/oe/types.py b/meta/lib/oe/types.py
index 7f47c17d0e..4ae58acfac 100644
--- a/meta/lib/oe/types.py
+++ b/meta/lib/oe/types.py
@@ -33,7 +33,7 @@ def choice(value, choices):
33 Acts as a multiple choice for the user. To use this, set the variable 33 Acts as a multiple choice for the user. To use this, set the variable
34 type flag to 'choice', and set the 'choices' flag to a space separated 34 type flag to 'choice', and set the 'choices' flag to a space separated
35 list of valid values.""" 35 list of valid values."""
36 if not isinstance(value, basestring): 36 if not isinstance(value, str):
37 raise TypeError("choice accepts a string, not '%s'" % type(value)) 37 raise TypeError("choice accepts a string, not '%s'" % type(value))
38 38
39 value = value.lower() 39 value = value.lower()
@@ -106,7 +106,7 @@ def boolean(value):
106 Valid values for false: 'no', 'n', 'false', 'f', '0' 106 Valid values for false: 'no', 'n', 'false', 'f', '0'
107 """ 107 """
108 108
109 if not isinstance(value, basestring): 109 if not isinstance(value, str):
110 raise TypeError("boolean accepts a string, not '%s'" % type(value)) 110 raise TypeError("boolean accepts a string, not '%s'" % type(value))
111 111
112 value = value.lower() 112 value = value.lower()
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index 1bbdbb4bd5..cecddc657f 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -46,7 +46,7 @@ def both_contain(variable1, variable2, checkvalue, d):
46 val2 = d.getVar(variable2, True) 46 val2 = d.getVar(variable2, True)
47 val1 = set(val1.split()) 47 val1 = set(val1.split())
48 val2 = set(val2.split()) 48 val2 = set(val2.split())
49 if isinstance(checkvalue, basestring): 49 if isinstance(checkvalue, str):
50 checkvalue = set(checkvalue.split()) 50 checkvalue = set(checkvalue.split())
51 else: 51 else:
52 checkvalue = set(checkvalue) 52 checkvalue = set(checkvalue)
@@ -235,7 +235,7 @@ def format_pkg_list(pkg_dict, ret_format=None):
235# so implement a version here 235# so implement a version here
236# 236#
237 237
238from Queue import Queue 238from queue import Queue
239from threading import Thread 239from threading import Thread
240 240
241class ThreadedWorker(Thread): 241class ThreadedWorker(Thread):
@@ -249,7 +249,7 @@ class ThreadedWorker(Thread):
249 self.worker_end = worker_end 249 self.worker_end = worker_end
250 250
251 def run(self): 251 def run(self):
252 from Queue import Empty 252 from queue import Empty
253 253
254 if self.worker_init is not None: 254 if self.worker_init is not None:
255 self.worker_init(self) 255 self.worker_init(self)
diff --git a/meta/lib/oeqa/controllers/masterimage.py b/meta/lib/oeqa/controllers/masterimage.py
index 522f9ebd76..4cb75539ee 100644
--- a/meta/lib/oeqa/controllers/masterimage.py
+++ b/meta/lib/oeqa/controllers/masterimage.py
@@ -24,9 +24,7 @@ from oeqa.utils import CommandError
24 24
25from abc import ABCMeta, abstractmethod 25from abc import ABCMeta, abstractmethod
26 26
27class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget): 27class MasterImageHardwareTarget(oeqa.targetcontrol.BaseTarget, metaclass=ABCMeta):
28
29 __metaclass__ = ABCMeta
30 28
31 supported_image_fstypes = ['tar.gz', 'tar.bz2'] 29 supported_image_fstypes = ['tar.gz', 'tar.bz2']
32 30
diff --git a/meta/lib/oeqa/oetest.py b/meta/lib/oeqa/oetest.py
index 4211ffc379..b4cf34b720 100644
--- a/meta/lib/oeqa/oetest.py
+++ b/meta/lib/oeqa/oetest.py
@@ -13,6 +13,7 @@ import inspect
13import subprocess 13import subprocess
14import signal 14import signal
15import shutil 15import shutil
16import functools
16try: 17try:
17 import bb 18 import bb
18except ImportError: 19except ImportError:
@@ -340,7 +341,14 @@ class TestContext(object):
340 for index, suite in enumerate(suites): 341 for index, suite in enumerate(suites):
341 set_suite_depth(suite) 342 set_suite_depth(suite)
342 suite.index = index 343 suite.index = index
343 suites.sort(cmp=lambda a,b: cmp((a.depth, a.index), (b.depth, b.index))) 344
345 def cmp(a, b):
346 return (a > b) - (a < b)
347
348 def cmpfunc(a, b):
349 return cmp((a.depth, a.index), (b.depth, b.index))
350
351 suites.sort(key=functools.cmp_to_key(cmpfunc))
344 352
345 self.suite = testloader.suiteClass(suites) 353 self.suite = testloader.suiteClass(suites)
346 354
diff --git a/meta/lib/oeqa/selftest/_toaster.py b/meta/lib/oeqa/selftest/_toaster.py
index c424659fdc..15ea9df9ef 100644
--- a/meta/lib/oeqa/selftest/_toaster.py
+++ b/meta/lib/oeqa/selftest/_toaster.py
@@ -2,7 +2,7 @@ import unittest
2import os 2import os
3import sys 3import sys
4import shlex, subprocess 4import shlex, subprocess
5import urllib, commands, time, getpass, re, json, shlex 5import urllib.request, urllib.parse, urllib.error, subprocess, time, getpass, re, json, shlex
6 6
7import oeqa.utils.ftools as ftools 7import oeqa.utils.ftools as ftools
8from oeqa.selftest.base import oeSelfTest 8from oeqa.selftest.base import oeSelfTest
@@ -290,7 +290,7 @@ class Toaster_DB_Tests(ToasterSetup):
290 layers = Layer.objects.values('id', 'layer_index_url') 290 layers = Layer.objects.values('id', 'layer_index_url')
291 cnt_err = [] 291 cnt_err = []
292 for layer in layers: 292 for layer in layers:
293 resp = urllib.urlopen(layer['layer_index_url']) 293 resp = urllib.request.urlopen(layer['layer_index_url'])
294 if (resp.getcode() != 200): 294 if (resp.getcode() != 200):
295 cnt_err.append(layer['id']) 295 cnt_err.append(layer['id'])
296 self.assertEqual(len(cnt_err), 0, msg = 'Errors for layer id: %s' % cnt_err) 296 self.assertEqual(len(cnt_err), 0, msg = 'Errors for layer id: %s' % cnt_err)
diff --git a/meta/lib/oeqa/selftest/recipetool.py b/meta/lib/oeqa/selftest/recipetool.py
index e72911b0aa..a93d18e275 100644
--- a/meta/lib/oeqa/selftest/recipetool.py
+++ b/meta/lib/oeqa/selftest/recipetool.py
@@ -1,7 +1,7 @@
1import os 1import os
2import logging 2import logging
3import tempfile 3import tempfile
4import urlparse 4import urllib.parse
5 5
6from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer 6from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer
7from oeqa.utils.decorators import testcase 7from oeqa.utils.decorators import testcase
@@ -471,7 +471,7 @@ class RecipetoolAppendsrcBase(RecipetoolBase):
471 '''Return the first file:// in SRC_URI for the specified recipe.''' 471 '''Return the first file:// in SRC_URI for the specified recipe.'''
472 src_uri = get_bb_var('SRC_URI', recipe).split() 472 src_uri = get_bb_var('SRC_URI', recipe).split()
473 for uri in src_uri: 473 for uri in src_uri:
474 p = urlparse.urlparse(uri) 474 p = urllib.parse.urlparse(uri)
475 if p.scheme == 'file': 475 if p.scheme == 'file':
476 return p.netloc + p.path 476 return p.netloc + p.path
477 477
diff --git a/meta/lib/oeqa/selftest/sstatetests.py b/meta/lib/oeqa/selftest/sstatetests.py
index cc64c6cb68..07212ac4f1 100644
--- a/meta/lib/oeqa/selftest/sstatetests.py
+++ b/meta/lib/oeqa/selftest/sstatetests.py
@@ -264,7 +264,7 @@ SDKMACHINE = "i686"
264 files2 = get_files(topdir + "/tmp-sstatesamehash2/stamps/") 264 files2 = get_files(topdir + "/tmp-sstatesamehash2/stamps/")
265 files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash").replace("i686-linux", "x86_64-linux").replace("i686" + targetvendor + "-linux", "x86_64" + targetvendor + "-linux", ) for x in files2] 265 files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash").replace("i686-linux", "x86_64-linux").replace("i686" + targetvendor + "-linux", "x86_64" + targetvendor + "-linux", ) for x in files2]
266 self.maxDiff = None 266 self.maxDiff = None
267 self.assertItemsEqual(files1, files2) 267 self.assertCountEqual(files1, files2)
268 268
269 269
270 @testcase(1271) 270 @testcase(1271)
@@ -298,7 +298,7 @@ NATIVELSBSTRING = \"DistroB\"
298 files2 = get_files(topdir + "/tmp-sstatesamehash2/stamps/") 298 files2 = get_files(topdir + "/tmp-sstatesamehash2/stamps/")
299 files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash") for x in files2] 299 files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash") for x in files2]
300 self.maxDiff = None 300 self.maxDiff = None
301 self.assertItemsEqual(files1, files2) 301 self.assertCountEqual(files1, files2)
302 302
303 @testcase(1368) 303 @testcase(1368)
304 def test_sstate_allarch_samesigs(self): 304 def test_sstate_allarch_samesigs(self):
@@ -393,7 +393,7 @@ DEFAULTTUNE_virtclass-multilib-lib32 = "x86"
393 files2 = get_files(topdir + "/tmp-sstatesamehash2/stamps") 393 files2 = get_files(topdir + "/tmp-sstatesamehash2/stamps")
394 files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash") for x in files2] 394 files2 = [x.replace("tmp-sstatesamehash2", "tmp-sstatesamehash") for x in files2]
395 self.maxDiff = None 395 self.maxDiff = None
396 self.assertItemsEqual(files1, files2) 396 self.assertCountEqual(files1, files2)
397 397
398 398
399 def test_sstate_noop_samesigs(self): 399 def test_sstate_noop_samesigs(self):
diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
index 5422a617c4..1c57efaaef 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -43,9 +43,7 @@ def get_target_controller(d):
43 return controller(d) 43 return controller(d)
44 44
45 45
46class BaseTarget(object): 46class BaseTarget(object, metaclass=ABCMeta):
47
48 __metaclass__ = ABCMeta
49 47
50 supported_image_fstypes = [] 48 supported_image_fstypes = []
51 49
diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 9a7c1d1375..18fe39ecfe 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -41,7 +41,7 @@ class Command(object):
41 self.data = data 41 self.data = data
42 42
43 self.options = dict(self.defaultopts) 43 self.options = dict(self.defaultopts)
44 if isinstance(self.cmd, basestring): 44 if isinstance(self.cmd, str):
45 self.options["shell"] = True 45 self.options["shell"] = True
46 if self.data: 46 if self.data:
47 self.options['stdin'] = subprocess.PIPE 47 self.options['stdin'] = subprocess.PIPE
@@ -123,7 +123,7 @@ def bitbake(command, ignore_status=False, timeout=None, postconfig=None, **optio
123 else: 123 else:
124 extra_args = "" 124 extra_args = ""
125 125
126 if isinstance(command, basestring): 126 if isinstance(command, str):
127 cmd = "bitbake " + extra_args + " " + command 127 cmd = "bitbake " + extra_args + " " + command
128 else: 128 else:
129 cmd = [ "bitbake" ] + [a for a in (command + extra_args.split(" ")) if a not in [""]] 129 cmd = [ "bitbake" ] + [a for a in (command + extra_args.split(" ")) if a not in [""]]
diff --git a/meta/lib/oeqa/utils/decorators.py b/meta/lib/oeqa/utils/decorators.py
index 6fb09db417..0b23565485 100644
--- a/meta/lib/oeqa/utils/decorators.py
+++ b/meta/lib/oeqa/utils/decorators.py
@@ -115,6 +115,8 @@ class NoParsingFilter(logging.Filter):
115 def filter(self, record): 115 def filter(self, record):
116 return record.levelno == 100 116 return record.levelno == 100
117 117
118import inspect
119
118def LogResults(original_class): 120def LogResults(original_class):
119 orig_method = original_class.run 121 orig_method = original_class.run
120 122
@@ -124,6 +126,19 @@ def LogResults(original_class):
124 logfile = os.path.join(os.getcwd(),'results-'+caller+'.'+timestamp+'.log') 126 logfile = os.path.join(os.getcwd(),'results-'+caller+'.'+timestamp+'.log')
125 linkfile = os.path.join(os.getcwd(),'results-'+caller+'.log') 127 linkfile = os.path.join(os.getcwd(),'results-'+caller+'.log')
126 128
129 def get_class_that_defined_method(meth):
130 if inspect.ismethod(meth):
131 for cls in inspect.getmro(meth.__self__.__class__):
132 if cls.__dict__.get(meth.__name__) is meth:
133 return cls
134 meth = meth.__func__ # fallback to __qualname__ parsing
135 if inspect.isfunction(meth):
136 cls = getattr(inspect.getmodule(meth),
137 meth.__qualname__.split('.<locals>', 1)[0].rsplit('.', 1)[0])
138 if isinstance(cls, type):
139 return cls
140 return None
141
127 #rewrite the run method of unittest.TestCase to add testcase logging 142 #rewrite the run method of unittest.TestCase to add testcase logging
128 def run(self, result, *args, **kws): 143 def run(self, result, *args, **kws):
129 orig_method(self, result, *args, **kws) 144 orig_method(self, result, *args, **kws)
@@ -135,7 +150,7 @@ def LogResults(original_class):
135 except AttributeError: 150 except AttributeError:
136 test_case = self._testMethodName 151 test_case = self._testMethodName
137 152
138 class_name = str(testMethod.im_class).split("'")[1] 153 class_name = str(get_class_that_defined_method(testMethod)).split("'")[1]
139 154
140 #create custom logging level for filtering. 155 #create custom logging level for filtering.
141 custom_log_level = 100 156 custom_log_level = 100
diff --git a/meta/lib/oeqa/utils/dump.py b/meta/lib/oeqa/utils/dump.py
index 63a591d366..71422a9aea 100644
--- a/meta/lib/oeqa/utils/dump.py
+++ b/meta/lib/oeqa/utils/dump.py
@@ -3,7 +3,7 @@ import sys
3import errno 3import errno
4import datetime 4import datetime
5import itertools 5import itertools
6from commands import runCmd 6from .commands import runCmd
7 7
8def get_host_dumper(d): 8def get_host_dumper(d):
9 cmds = d.getVar("testimage_dump_host", True) 9 cmds = d.getVar("testimage_dump_host", True)
diff --git a/meta/lib/oeqa/utils/httpserver.py b/meta/lib/oeqa/utils/httpserver.py
index 76518d8ef9..bd76f36468 100644
--- a/meta/lib/oeqa/utils/httpserver.py
+++ b/meta/lib/oeqa/utils/httpserver.py
@@ -1,8 +1,8 @@
1import SimpleHTTPServer 1import http.server
2import multiprocessing 2import multiprocessing
3import os 3import os
4 4
5class HTTPServer(SimpleHTTPServer.BaseHTTPServer.HTTPServer): 5class HTTPServer(http.server.HTTPServer):
6 6
7 def server_start(self, root_dir): 7 def server_start(self, root_dir):
8 import signal 8 import signal
@@ -10,7 +10,7 @@ class HTTPServer(SimpleHTTPServer.BaseHTTPServer.HTTPServer):
10 os.chdir(root_dir) 10 os.chdir(root_dir)
11 self.serve_forever() 11 self.serve_forever()
12 12
13class HTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): 13class HTTPRequestHandler(http.server.SimpleHTTPRequestHandler):
14 14
15 def log_message(self, format_str, *args): 15 def log_message(self, format_str, *args):
16 pass 16 pass
diff --git a/meta/lib/oeqa/utils/logparser.py b/meta/lib/oeqa/utils/logparser.py
index 87b50354cd..b377dcd271 100644
--- a/meta/lib/oeqa/utils/logparser.py
+++ b/meta/lib/oeqa/utils/logparser.py
@@ -3,7 +3,7 @@
3import sys 3import sys
4import os 4import os
5import re 5import re
6import ftools 6from . import ftools
7 7
8 8
9# A parser that can be used to identify weather a line is a test result or a section statement. 9# A parser that can be used to identify weather a line is a test result or a section statement.
diff --git a/meta/lib/oeqa/utils/qemurunner.py b/meta/lib/oeqa/utils/qemurunner.py
index 3d60433cae..e408fbbf3a 100644
--- a/meta/lib/oeqa/utils/qemurunner.py
+++ b/meta/lib/oeqa/utils/qemurunner.py
@@ -23,8 +23,8 @@ logger = logging.getLogger("BitBake.QemuRunner")
23 23
24# Get Unicode non printable control chars 24# Get Unicode non printable control chars
25control_range = list(range(0,32))+list(range(127,160)) 25control_range = list(range(0,32))+list(range(127,160))
26control_chars = [unichr(x) for x in control_range 26control_chars = [chr(x) for x in control_range
27 if unichr(x) not in string.printable] 27 if chr(x) not in string.printable]
28re_control_char = re.compile('[%s]' % re.escape("".join(control_chars))) 28re_control_char = re.compile('[%s]' % re.escape("".join(control_chars)))
29 29
30class QemuRunner: 30class QemuRunner:
@@ -220,6 +220,7 @@ class QemuRunner:
220 stopread = False 220 stopread = False
221 qemusock = None 221 qemusock = None
222 bootlog = '' 222 bootlog = ''
223 data = b''
223 while time.time() < endtime and not stopread: 224 while time.time() < endtime and not stopread:
224 sread, swrite, serror = select.select(socklist, [], [], 5) 225 sread, swrite, serror = select.select(socklist, [], [], 5)
225 for sock in sread: 226 for sock in sread:
@@ -283,13 +284,14 @@ class QemuRunner:
283 if hasattr(self, "origchldhandler"): 284 if hasattr(self, "origchldhandler"):
284 signal.signal(signal.SIGCHLD, self.origchldhandler) 285 signal.signal(signal.SIGCHLD, self.origchldhandler)
285 if self.runqemu: 286 if self.runqemu:
286 os.kill(self.monitorpid, signal.SIGKILL) 287 if hasattr(self, "monitorpid"):
287 logger.info("Sending SIGTERM to runqemu") 288 os.kill(self.monitorpid, signal.SIGKILL)
288 try: 289 logger.info("Sending SIGTERM to runqemu")
289 os.killpg(os.getpgid(self.runqemu.pid), signal.SIGTERM) 290 try:
290 except OSError as e: 291 os.killpg(os.getpgid(self.runqemu.pid), signal.SIGTERM)
291 if e.errno != errno.ESRCH: 292 except OSError as e:
292 raise 293 if e.errno != errno.ESRCH:
294 raise
293 endtime = time.time() + self.runqemutime 295 endtime = time.time() + self.runqemutime
294 while self.runqemu.poll() is None and time.time() < endtime: 296 while self.runqemu.poll() is None and time.time() < endtime:
295 time.sleep(1) 297 time.sleep(1)
@@ -448,7 +450,7 @@ class LoggingThread(threading.Thread):
448 def stop(self): 450 def stop(self):
449 self.logger.info("Stopping logging thread") 451 self.logger.info("Stopping logging thread")
450 if self.running: 452 if self.running:
451 os.write(self.writepipe, "stop") 453 os.write(self.writepipe, bytes("stop", "utf-8"))
452 454
453 def teardown(self): 455 def teardown(self):
454 self.logger.info("Tearing down logging thread") 456 self.logger.info("Tearing down logging thread")
diff --git a/meta/lib/oeqa/utils/qemutinyrunner.py b/meta/lib/oeqa/utils/qemutinyrunner.py
index 054ab0ec5d..c823157ad6 100644
--- a/meta/lib/oeqa/utils/qemutinyrunner.py
+++ b/meta/lib/oeqa/utils/qemutinyrunner.py
@@ -13,7 +13,7 @@ import re
13import socket 13import socket
14import select 14import select
15import bb 15import bb
16from qemurunner import QemuRunner 16from .qemurunner import QemuRunner
17 17
18class QemuTinyRunner(QemuRunner): 18class QemuTinyRunner(QemuRunner):
19 19
diff --git a/meta/lib/oeqa/utils/targetbuild.py b/meta/lib/oeqa/utils/targetbuild.py
index f850d78df1..d538f6b65f 100644
--- a/meta/lib/oeqa/utils/targetbuild.py
+++ b/meta/lib/oeqa/utils/targetbuild.py
@@ -10,9 +10,7 @@ import bb.utils
10import subprocess 10import subprocess
11from abc import ABCMeta, abstractmethod 11from abc import ABCMeta, abstractmethod
12 12
13class BuildProject(): 13class BuildProject(metaclass=ABCMeta):
14
15 __metaclass__ = ABCMeta
16 14
17 def __init__(self, d, uri, foldername=None, tmpdir="/tmp/"): 15 def __init__(self, d, uri, foldername=None, tmpdir="/tmp/"):
18 self.d = d 16 self.d = d
diff --git a/meta/lib/oeqa/utils/testexport.py b/meta/lib/oeqa/utils/testexport.py
index 4fbf4bdcb3..57be2ca449 100644
--- a/meta/lib/oeqa/utils/testexport.py
+++ b/meta/lib/oeqa/utils/testexport.py
@@ -6,7 +6,7 @@
6 6
7import os, re, glob as g, shutil as sh,sys 7import os, re, glob as g, shutil as sh,sys
8from time import sleep 8from time import sleep
9from commands import runCmd 9from .commands import runCmd
10from difflib import SequenceMatcher as SM 10from difflib import SequenceMatcher as SM
11 11
12try: 12try: