misc: Replace __metaclass__ with six.add_metaclass
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Fri, 28 Feb 2020 14:56:16 +0000 (14:56 +0000)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Tue, 10 Mar 2020 09:35:56 +0000 (09:35 +0000)
Change-Id: I45f73b71266c1edf9c4ec521d58db779b16bd591
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/26245
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Jason Lowe-Power <jason@lowepower.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/SConscript
src/arch/x86/isa/microops/fpop.isa
src/arch/x86/isa/microops/mediaop.isa
src/arch/x86/isa/microops/regop.isa
src/systemc/tests/verify.py

index fc9df2cfc47f93cee46e18094af764dee6dc2c6b..03fae53c33ccb8333ed684205f995ca73e2fc657 100644 (file)
@@ -45,6 +45,7 @@ import functools
 import imp
 import os
 import re
+import six
 import sys
 import zlib
 
@@ -142,12 +143,12 @@ class SourceMeta(type):
         super(SourceMeta, cls).__init__(name, bases, dict)
         cls.all = SourceList()
 
+@six.add_metaclass(SourceMeta)
 class SourceFile(object):
     '''Base object that encapsulates the notion of a source file.
     This includes, the source node, target node, various manipulations
     of those.  A source file also specifies a set of tags which
     describing arbitrary properties of the source file.'''
-    __metaclass__ = SourceMeta
 
     static_objs = {}
     shared_objs = {}
@@ -413,9 +414,9 @@ class ExecutableMeta(type):
 
         cls.all = []
 
+@six.add_metaclass(ExecutableMeta)
 class Executable(object):
     '''Base class for creating an executable from sources.'''
-    __metaclass__ = ExecutableMeta
 
     abstract = True
 
index ab7513a75659822801e23aedd69e4eeaecf17377..a4a1374313456f5df56c22cf727fa3ed77f09b08 100644 (file)
@@ -100,6 +100,9 @@ def template MicroFpOpConstructor {{
 }};
 
 let {{
+
+    import six
+
     # Make these empty strings so that concatenating onto
     # them will always work.
     header_output = ""
@@ -192,8 +195,8 @@ let {{
 
             return cls
 
+    @six.add_metaclass(FpOpMeta)
     class FpUnaryOp(X86Microop):
-        __metaclass__ = FpOpMeta
         # This class itself doesn't act as a microop
         abstract = True
 
@@ -228,8 +231,8 @@ let {{
                 "dataSize" : self.dataSize,
                 "spm" : self.spm}
 
+    @six.add_metaclass(FpOpMeta)
     class FpBinaryOp(X86Microop):
-        __metaclass__ = FpOpMeta
         # This class itself doesn't act as a microop
         abstract = True
 
index 1807e80ea655a8247547ccc6faabd0d60779fc85..6ef263a07aec8d2cb716cc8182323afade0fd605 100644 (file)
@@ -194,8 +194,8 @@ let {{
             return cls
 
 
+    @six.add_metaclass(MediaOpMeta)
     class MediaOp(X86Microop):
-        __metaclass__ = MediaOpMeta
         # This class itself doesn't act as a microop
         abstract = True
 
index 3b743332086b98b4b00c6f3d4d4843f1a760041c..d64ace4fa3c58c5a86f171ad9734c2c3648a4875 100644 (file)
@@ -373,8 +373,8 @@ let {{
             return cls
 
 
+    @six.add_metaclass(RegOpMeta)
     class RegOp(X86Microop):
-        __metaclass__ = RegOpMeta
         # This class itself doesn't act as a microop
         abstract = True
 
index 4d55659d82f36700a105714122a476511ecdb9f8..5ca783f0dc367030c2ac8d69bd302186a9d12ad4 100755 (executable)
@@ -38,6 +38,7 @@ import multiprocessing.pool
 import os
 import re
 import subprocess
+import six
 import sys
 
 script_path = os.path.abspath(inspect.getfile(inspect.currentframe()))
@@ -109,8 +110,8 @@ class TestPhaseMeta(type):
 
         super(TestPhaseMeta, cls).__init__(name, bases, d)
 
+@six.add_metaclass(TestPhaseMeta)
 class TestPhaseBase(object):
-    __metaclass__ = TestPhaseMeta
     abstract = True
 
     def __init__(self, main_args, *args):