From: Andreas Sandberg Date: Thu, 21 Jan 2021 17:09:38 +0000 (+0000) Subject: python: Remove Python 2.7 compatibility code X-Git-Tag: develop-gem5-snapshot~256 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4b9c46caa55212c26e119e54e005b6f4880d2ba8;p=gem5.git python: Remove Python 2.7 compatibility code We don't support Python 2.7 anymore. Remove glue code like the six dependency and "from __future__" imports from gem5's standard library. Change-Id: I71834c325f86ff0329b222be87794ead96081f05 Signed-off-by: Andreas Sandberg Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39584 Tested-by: kokoro Reviewed-by: Gabe Black Maintainer: Jason Lowe-Power --- diff --git a/src/python/importer.py b/src/python/importer.py index c29fb7bd1..b89b4a8d1 100644 --- a/src/python/importer.py +++ b/src/python/importer.py @@ -24,9 +24,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function -from __future__ import absolute_import - # Simple importer that allows python to import data from a dict of # code objects. The keys are the module path, and the items are the # filename and bytecode of the file. diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py index b47d98d83..1697237a9 100644 --- a/src/python/m5/SimObject.py +++ b/src/python/m5/SimObject.py @@ -38,13 +38,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function -from __future__ import absolute_import -from six import add_metaclass -import six -if six.PY3: - long = int - import sys from types import FunctionType, MethodType, ModuleType from functools import wraps @@ -1178,8 +1171,7 @@ class SimObjectCliWrapper(object): # The SimObject class is the root of the special hierarchy. Most of # the code in this class deals with the configuration hierarchy itself # (parent/child node relationships). -@add_metaclass(MetaSimObject) -class SimObject(object): +class SimObject(object, metaclass=MetaSimObject): # Specify metaclass. Any class inheriting from SimObject will # get this metaclass. type = 'SimObject' diff --git a/src/python/m5/__init__.py b/src/python/m5/__init__.py index 309764dbc..254d9a682 100644 --- a/src/python/m5/__init__.py +++ b/src/python/m5/__init__.py @@ -24,9 +24,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function -from __future__ import absolute_import - # Import useful subpackages of M5, but *only* when run as an m5 # script. This is mostly to keep backward compatibility with existing # scripts while allowing new SCons code to operate properly. diff --git a/src/python/m5/core.py b/src/python/m5/core.py index 34d54bc6e..fcbf4aa49 100644 --- a/src/python/m5/core.py +++ b/src/python/m5/core.py @@ -36,8 +36,5 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function -from __future__ import absolute_import - from _m5.core import setOutputDir from _m5.loader import setInterpDir diff --git a/src/python/m5/debug.py b/src/python/m5/debug.py index 6b45b16ff..10d0980c2 100644 --- a/src/python/m5/debug.py +++ b/src/python/m5/debug.py @@ -24,8 +24,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function - from collections import Mapping import _m5.debug diff --git a/src/python/m5/event.py b/src/python/m5/event.py index 9b5532c3e..f0230cffb 100644 --- a/src/python/m5/event.py +++ b/src/python/m5/event.py @@ -38,8 +38,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function - import m5 import _m5.event diff --git a/src/python/m5/ext/__init__.py b/src/python/m5/ext/__init__.py index f950c9832..cdd1f4277 100644 --- a/src/python/m5/ext/__init__.py +++ b/src/python/m5/ext/__init__.py @@ -35,5 +35,3 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function -from __future__ import absolute_import diff --git a/src/python/m5/internal/params.py b/src/python/m5/internal/params.py index 1cc6e3a53..2fc79c0c8 100644 --- a/src/python/m5/internal/params.py +++ b/src/python/m5/internal/params.py @@ -36,9 +36,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function -from __future__ import absolute_import - import inspect import _m5 diff --git a/src/python/m5/main.py b/src/python/m5/main.py index 34088898b..9342ad0bd 100644 --- a/src/python/m5/main.py +++ b/src/python/m5/main.py @@ -36,8 +36,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function - import code import datetime import os diff --git a/src/python/m5/objects/__init__.py b/src/python/m5/objects/__init__.py index f1ff90087..3ec3b8cb3 100644 --- a/src/python/m5/objects/__init__.py +++ b/src/python/m5/objects/__init__.py @@ -24,9 +24,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function -from __future__ import absolute_import - from m5.internal import params from m5.SimObject import * diff --git a/src/python/m5/options.py b/src/python/m5/options.py index eea2e1d89..a58016010 100644 --- a/src/python/m5/options.py +++ b/src/python/m5/options.py @@ -24,9 +24,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function -from __future__ import absolute_import - import optparse import sys diff --git a/src/python/m5/params.py b/src/python/m5/params.py index 45082d7ac..5ff507189 100644 --- a/src/python/m5/params.py +++ b/src/python/m5/params.py @@ -54,12 +54,6 @@ # ##################################################################### -from __future__ import print_function -from six import with_metaclass -import six -if six.PY3: - long = int - import copy import datetime import re @@ -97,7 +91,7 @@ class MetaParamValue(type): # Dummy base class to identify types that are legitimate for SimObject # parameters. -class ParamValue(with_metaclass(MetaParamValue, object)): +class ParamValue(object, metaclass=MetaParamValue): cmd_line_settable = False # Generate the code needed as a prerequisite for declaring a C++ @@ -235,7 +229,7 @@ class ParamDesc(object): # that the value is a vector (list) of the specified type instead of a # single value. -class VectorParamValue(with_metaclass(MetaParamValue, list)): +class VectorParamValue(list, metaclass=MetaParamValue): def __setattr__(self, attr, value): raise AttributeError("Not allowed to set %s on '%s'" % \ (attr, type(self).__name__)) @@ -467,9 +461,6 @@ class NumericParamValue(ParamValue): def __float__(self): return float(self.value) - def __long__(self): - return long(self.value) - def __int__(self): return int(self.value) @@ -538,11 +529,6 @@ class NumericParamValue(ParamValue): def __lt__(self, other): return self.value < NumericParamValue.unwrap(other) - # Python 2.7 pre __future__.division operators - # TODO: Remove these when after "import division from __future__" - __div__ = __truediv__ - __idiv__ = __itruediv__ - def config_value(self): return self.value @@ -586,7 +572,7 @@ class CheckedIntType(MetaParamValue): # class is subclassed to generate parameter classes with specific # bounds. Initialization of the min and max bounds is done in the # metaclass CheckedIntType.__init__. -class CheckedInt(with_metaclass(CheckedIntType, NumericParamValue)): +class CheckedInt(NumericParamValue, metaclass=CheckedIntType): cmd_line_settable = True def _check(self): @@ -597,8 +583,8 @@ class CheckedInt(with_metaclass(CheckedIntType, NumericParamValue)): def __init__(self, value): if isinstance(value, str): self.value = convert.toInteger(value) - elif isinstance(value, (int, long, float, NumericParamValue)): - self.value = long(value) + elif isinstance(value, (int, float, NumericParamValue)): + self.value = int(value) else: raise TypeError("Can't convert object of type %s to CheckedInt" \ % type(value).__name__) @@ -617,7 +603,7 @@ class CheckedInt(with_metaclass(CheckedIntType, NumericParamValue)): code('#include "base/types.hh"') def getValue(self): - return long(self.value) + return int(self.value) class Int(CheckedInt): cxx_type = 'int'; size = 32; unsigned = False class Unsigned(CheckedInt): cxx_type = 'unsigned'; size = 32; unsigned = True @@ -666,7 +652,7 @@ class Float(ParamValue, float): cmd_line_settable = True def __init__(self, value): - if isinstance(value, (int, long, float, NumericParamValue, Float, str)): + if isinstance(value, (int, float, NumericParamValue, Float, str)): self.value = float(value) else: raise TypeError("Can't convert object of type %s to Float" \ @@ -732,7 +718,7 @@ class Addr(CheckedInt): except (TypeError, ValueError): # Convert number to string and use long() to do automatic # base conversion (requires base=0 for auto-conversion) - self.value = long(str(value), base=0) + self.value = int(str(value), base=0) self._check() def __add__(self, other): @@ -744,8 +730,8 @@ class Addr(CheckedInt): try: val = convert.toMemorySize(value) except TypeError: - val = long(value) - return "0x%x" % long(val) + val = int(value) + return "0x%x" % int(val) class AddrRange(ParamValue): cxx_type = 'AddrRange' @@ -772,7 +758,7 @@ class AddrRange(ParamValue): self.intlvMatch = int(kwargs.pop('intlvMatch')) if 'masks' in kwargs: - self.masks = [ long(x) for x in list(kwargs.pop('masks')) ] + self.masks = [ int(x) for x in list(kwargs.pop('masks')) ] self.intlvBits = len(self.masks) else: if 'intlvBits' in kwargs: @@ -825,7 +811,7 @@ class AddrRange(ParamValue): def size(self): # Divide the size by the size of the interleaving slice - return (long(self.end) - long(self.start)) >> self.intlvBits + return (int(self.end) - int(self.start)) >> self.intlvBits @classmethod def cxx_predecls(cls, code): @@ -875,7 +861,7 @@ class AddrRange(ParamValue): # Go from the Python class to the wrapped C++ class from _m5.range import AddrRange - return AddrRange(long(self.start), long(self.end), + return AddrRange(int(self.start), int(self.end), self.masks, int(self.intlvMatch)) # Boolean parameter type. Python doesn't let you subclass bool, since @@ -1016,7 +1002,7 @@ class IpAddress(ParamValue): try: self.ip = convert.toIpAddress(value) except TypeError: - self.ip = long(value) + self.ip = int(value) self.verifyIp() def __call__(self, value): @@ -1218,7 +1204,7 @@ def parse_time(value): if isinstance(value, struct_time): return value - if isinstance(value, (int, long)): + if isinstance(value, int): return gmtime(value) if isinstance(value, (datetime, date)): @@ -1444,7 +1430,7 @@ module_init(py::module &m_internal) # Base class for enum types. -class Enum(with_metaclass(MetaEnum, ParamValue)): +class Enum(ParamValue, metaclass=MetaEnum): vals = [] cmd_line_settable = True @@ -1538,7 +1524,7 @@ class TickParamValue(NumericParamValue): return value def getValue(self): - return long(self.value) + return int(self.value) @classmethod def cxx_ini_predecls(cls, code): @@ -1583,7 +1569,7 @@ class Latency(TickParamValue): value = self.value else: value = ticks.fromSeconds(self.value) - return long(value) + return int(value) def config_value(self): return self.getValue() @@ -1626,7 +1612,7 @@ class Frequency(TickParamValue): value = self.value else: value = ticks.fromSeconds(1.0 / self.value) - return long(value) + return int(value) def config_value(self): return self.getValue() @@ -1792,7 +1778,7 @@ class MemoryBandwidth(float,ParamValue): # make_param_value() above that lets these be assigned where a # SimObject is required. # only one copy of a particular node -class NullSimObject(with_metaclass(Singleton, object)): +class NullSimObject(object, metaclass=Singleton): _name = 'Null' def __call__(cls): @@ -2159,7 +2145,7 @@ VectorSlavePort = VectorResponsePort # 'Fake' ParamDesc for Port references to assign to the _pdesc slot of # proxy objects (via set_param_desc()) so that proxy error messages # make sense. -class PortParamDesc(with_metaclass(Singleton, object)): +class PortParamDesc(object, metaclass=Singleton): ptype_str = 'Port' ptype = Port diff --git a/src/python/m5/proxy.py b/src/python/m5/proxy.py index d15b6f297..fe4cb658e 100644 --- a/src/python/m5/proxy.py +++ b/src/python/m5/proxy.py @@ -42,15 +42,8 @@ # ##################################################################### -from __future__ import print_function -from __future__ import absolute_import -import six -if six.PY3: - long = int - import copy - class BaseProxy(object): def __init__(self, search_self, search_up): self._search_self = search_self @@ -74,7 +67,7 @@ class BaseProxy(object): def _gen_op(operation): def op(self, operand): - if not (isinstance(operand, (int, long, float)) or \ + if not (isinstance(operand, (int, float)) or \ isproxy(operand)): raise TypeError( "Proxy operand must be a constant or a proxy to a param") diff --git a/src/python/m5/simulate.py b/src/python/m5/simulate.py index 080d725a1..a1a05dc96 100644 --- a/src/python/m5/simulate.py +++ b/src/python/m5/simulate.py @@ -37,8 +37,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function - import atexit import os import sys diff --git a/src/python/m5/stats/__init__.py b/src/python/m5/stats/__init__.py index 1fc6c9c08..cba1a32df 100644 --- a/src/python/m5/stats/__init__.py +++ b/src/python/m5/stats/__init__.py @@ -37,9 +37,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function -from __future__ import absolute_import - import m5 import _m5.stats diff --git a/src/python/m5/ticks.py b/src/python/m5/ticks.py index cdba1e86a..1ec012bd5 100644 --- a/src/python/m5/ticks.py +++ b/src/python/m5/ticks.py @@ -24,11 +24,7 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function import decimal -import six -if six.PY3: - long = int import sys from m5.util import warn @@ -42,7 +38,7 @@ def setGlobalFrequency(ticksPerSecond): from m5.util import convert import _m5.core - if isinstance(ticksPerSecond, (int, long)): + if isinstance(ticksPerSecond, int): tps = ticksPerSecond elif isinstance(ticksPerSecond, float): tps = ticksPerSecond diff --git a/src/python/m5/trace.py b/src/python/m5/trace.py index f7b464ce9..9603914ca 100644 --- a/src/python/m5/trace.py +++ b/src/python/m5/trace.py @@ -24,8 +24,5 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function -from __future__ import absolute_import - # Export native methods to Python from _m5.trace import output, ignore, disable, enable diff --git a/src/python/m5/util/__init__.py b/src/python/m5/util/__init__.py index deab0fc8e..74c0ec02d 100644 --- a/src/python/m5/util/__init__.py +++ b/src/python/m5/util/__init__.py @@ -37,14 +37,11 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function - import os import re import sys -from six import string_types -from six.moves import zip_longest +from itertools import zip_longest from . import convert from . import jobfile @@ -123,7 +120,7 @@ def compareVersions(v1, v2): def make_version_list(v): if isinstance(v, (list,tuple)): return v - elif isinstance(v, string_types): + elif isinstance(v, str): return list(map(lambda x: int(re.match('\d+', x).group()), v.split('.'))) else: diff --git a/src/python/m5/util/attrdict.py b/src/python/m5/util/attrdict.py index 453daf794..a072783dc 100644 --- a/src/python/m5/util/attrdict.py +++ b/src/python/m5/util/attrdict.py @@ -24,8 +24,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function - __all__ = [ 'attrdict', 'multiattrdict', 'optiondict' ] class attrdict(dict): diff --git a/src/python/m5/util/code_formatter.py b/src/python/m5/util/code_formatter.py index 37880de65..0ca8c98a6 100644 --- a/src/python/m5/util/code_formatter.py +++ b/src/python/m5/util/code_formatter.py @@ -24,9 +24,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function -from six import add_metaclass - try: import builtins except ImportError: @@ -112,8 +109,7 @@ class code_formatter_meta(type): } cls.pattern = re.compile(pat, re.VERBOSE | re.DOTALL | re.MULTILINE) -@add_metaclass(code_formatter_meta) -class code_formatter(object): +class code_formatter(object, metaclass=code_formatter_meta): delim = r'$' ident = r'[_A-z]\w*' pos = r'[0-9]+' diff --git a/src/python/m5/util/convert.py b/src/python/m5/util/convert.py index 73335e62b..ff452cdf7 100644 --- a/src/python/m5/util/convert.py +++ b/src/python/m5/util/convert.py @@ -25,10 +25,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import six -if six.PY3: - long = int - # metric prefixes atto = 1.0e-18 femto = 1.0e-15 diff --git a/src/python/m5/util/dot_writer.py b/src/python/m5/util/dot_writer.py index 8b757e835..7b10fdcf3 100644 --- a/src/python/m5/util/dot_writer.py +++ b/src/python/m5/util/dot_writer.py @@ -53,9 +53,6 @@ # ##################################################################### -from __future__ import print_function -from __future__ import absolute_import - import m5, os, re from m5.SimObject import isRoot, isSimObjectVector from m5.params import PortRef, isNullPointer diff --git a/src/python/m5/util/fdthelper.py b/src/python/m5/util/fdthelper.py index 7ad3aba13..d9dec1196 100644 --- a/src/python/m5/util/fdthelper.py +++ b/src/python/m5/util/fdthelper.py @@ -35,10 +35,6 @@ # # Author: Glenn Bergmans -import six -if six.PY3: - long = int - from m5.ext.pyfdt import pyfdt import re import os @@ -56,7 +52,7 @@ class FdtPropertyWords(pyfdt.FdtPropertyWords): words = [words] # Make sure all values are ints (use automatic base detection if the # type is str) - words = [long(w, base=0) if type(w) == str else long(w) for w in words] + words = [int(w, base=0) if type(w) == str else int(w) for w in words] super(FdtPropertyWords, self).__init__(name, words) class FdtPropertyStrings(pyfdt.FdtPropertyStrings): @@ -122,7 +118,7 @@ class FdtState(object): def int_to_cells(self, value, cells): """Helper function for: generates a list of 32 bit cells from an int, used to split up addresses in appropriate 32 bit chunks.""" - value = long(value) + value = int(value) if (value >> (32 * cells)) != 0: fatal("Value %d doesn't fit in %d cells" % (value, cells)) diff --git a/src/python/m5/util/grammar.py b/src/python/m5/util/grammar.py index e09c989ee..9aba74626 100644 --- a/src/python/m5/util/grammar.py +++ b/src/python/m5/util/grammar.py @@ -25,7 +25,6 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. import os -from six import string_types import ply.lex import ply.yacc @@ -94,7 +93,7 @@ class Grammar(object): "'%s' object has no attribute '%s'" % (type(self), attr)) def parse_string(self, data, source='', debug=None, tracking=0): - if not isinstance(data, string_types): + if not isinstance(data, str): raise AttributeError( "argument must be a string, was '%s'" % type(f)) @@ -113,7 +112,7 @@ class Grammar(object): return result def parse_file(self, f, **kwargs): - if isinstance(f, string_types): + if isinstance(f, str): source = f f = open(f, 'r') elif isinstance(f, file): diff --git a/src/python/m5/util/jobfile.py b/src/python/m5/util/jobfile.py index e1bd5b2c2..e262cf160 100644 --- a/src/python/m5/util/jobfile.py +++ b/src/python/m5/util/jobfile.py @@ -24,9 +24,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function -from __future__ import absolute_import - import sys class Data(object): diff --git a/src/python/m5/util/multidict.py b/src/python/m5/util/multidict.py index 155890766..78b2c8b02 100644 --- a/src/python/m5/util/multidict.py +++ b/src/python/m5/util/multidict.py @@ -24,8 +24,6 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function - __all__ = [ 'multidict' ] class multidict(object): diff --git a/src/python/m5/util/pybind.py b/src/python/m5/util/pybind.py index 18df3bb60..bb73be994 100644 --- a/src/python/m5/util/pybind.py +++ b/src/python/m5/util/pybind.py @@ -33,14 +33,9 @@ # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -from __future__ import print_function -from __future__ import absolute_import -from six import add_metaclass - from abc import * -@add_metaclass(ABCMeta) -class PyBindExport(object): +class PyBindExport(object, metaclass=ABCMeta): @abstractmethod def export(self, code, cname): pass diff --git a/src/python/m5/util/terminal.py b/src/python/m5/util/terminal.py index bb4ac80fe..f50e92dba 100644 --- a/src/python/m5/util/terminal.py +++ b/src/python/m5/util/terminal.py @@ -26,9 +26,6 @@ # # Author: Steve Reinhardt -from __future__ import print_function -from __future__ import absolute_import - import sys # Intended usage example: