[OE-core] [PATCH 07/16] scripts: python3: use new metaclass syntax

Ed Bartosh ed.bartosh at linux.intel.com
Thu Jun 2 10:12:53 UTC 2016


Used metaclass=<metaclass> syntax instead old
__metaclass__ = <metaclass> as only new one is supported
in python 3.

Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
---
 scripts/lib/bsp/engine.py | 6 ++----
 scripts/test-remote-image | 8 ++------
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/scripts/lib/bsp/engine.py b/scripts/lib/bsp/engine.py
index f75454d..5b49486 100644
--- a/scripts/lib/bsp/engine.py
+++ b/scripts/lib/bsp/engine.py
@@ -40,12 +40,11 @@ import json
 import subprocess
 import shutil
 
-class Line():
+class Line(metaclass=ABCMeta):
     """
     Generic (abstract) container representing a line that will appear
     in the BSP-generating program.
     """
-    __metaclass__ = ABCMeta
 
     def __init__(self, line):
         self.line = line
@@ -319,11 +318,10 @@ class BooleanInputLine(InputLine):
         return line
 
 
-class ListInputLine(InputLine):
+class ListInputLine(InputLine, metaclass=ABCMeta):
     """
     Base class for List-based Input lines. e.g. Choicelist, Checklist.
     """
-    __metaclass__ = ABCMeta
 
     def __init__(self, props, tag, lineno):
         InputLine.__init__(self, props, tag, lineno)
diff --git a/scripts/test-remote-image b/scripts/test-remote-image
index 7a00db9..698948b 100755
--- a/scripts/test-remote-image
+++ b/scripts/test-remote-image
@@ -92,13 +92,11 @@ def get_args_parser():
     parser.add_argument('--skip-download', required=False, action="store_true", dest="skip_download", default=False, help='Skip downloading the images completely. This needs the correct files to be present in the directory specified by the target profile.')
     return parser
 
-class BaseTargetProfile(object):
+class BaseTargetProfile(object, metaclass=ABCMeta):
     """
     This class defines the meta profile for a specific target (MACHINE type + image type).
     """
 
-    __metaclass__ = ABCMeta
-
     def __init__(self, image_type):
         self.image_type = image_type
 
@@ -191,13 +189,11 @@ class AutoTargetProfile(BaseTargetProfile):
         return controller.get_extra_files()
 
 
-class BaseRepoProfile(object):
+class BaseRepoProfile(object, metaclass=ABCMeta):
     """
     This class defines the meta profile for an images repository.
     """
 
-    __metaclass__ = ABCMeta
-
     def __init__(self, repolink, localdir):
         self.localdir = localdir
         self.repolink = repolink
-- 
2.1.4




More information about the Openembedded-core mailing list