util: Remove Python 2.7 glue code
Remove uses of six and from __future__ imports as they are no longer needed. Change-Id: I8d6aae84d8192b301d541b8dc81275f4932f9f2f Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/39756 Reviewed-by: Gabe Black <gabe.black@gmail.com> Reviewed-by: Jason Lowe-Power <power.jg@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -32,7 +32,6 @@ import os
|
|||||||
import os.path
|
import os.path
|
||||||
import pickle
|
import pickle
|
||||||
import shutil
|
import shutil
|
||||||
import six
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
@@ -145,9 +144,9 @@ def run_commands(working_dir, *cmds):
|
|||||||
# Settings.
|
# Settings.
|
||||||
#
|
#
|
||||||
|
|
||||||
class MetaSetting(type):
|
class MetaSetting(abc.ABCMeta):
|
||||||
def __new__(mcls, name, bases, d):
|
def __new__(mcls, name, bases, d):
|
||||||
cls = super(MetaSetting, mcls).__new__(mcls, name, bases, d)
|
cls = super().__new__(mcls, name, bases, d)
|
||||||
key = d.get('key', None)
|
key = d.get('key', None)
|
||||||
if key is not None:
|
if key is not None:
|
||||||
assert('default' in d)
|
assert('default' in d)
|
||||||
@@ -157,9 +156,7 @@ class MetaSetting(type):
|
|||||||
all_settings[key] = instance
|
all_settings[key] = instance
|
||||||
return cls
|
return cls
|
||||||
|
|
||||||
@six.add_metaclass(MetaSetting)
|
class Setting(object, metaclass=MetaSetting):
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
|
||||||
class Setting(object):
|
|
||||||
key = None
|
key = None
|
||||||
|
|
||||||
@abc.abstractmethod
|
@abc.abstractmethod
|
||||||
@@ -420,17 +417,15 @@ class Parallelism(Setting):
|
|||||||
# Steps of the build process.
|
# Steps of the build process.
|
||||||
#
|
#
|
||||||
|
|
||||||
class MetaStep(type):
|
class MetaStep(abc.ABCMeta):
|
||||||
def __new__(mcls, name, bases, d):
|
def __new__(mcls, name, bases, d):
|
||||||
cls = super(MetaStep, mcls).__new__(mcls, name, bases, d)
|
cls = super().__new__(mcls, name, bases, d)
|
||||||
number = d.get('number', None)
|
number = d.get('number', None)
|
||||||
if number is not None:
|
if number is not None:
|
||||||
all_steps[number] = cls()
|
all_steps[number] = cls()
|
||||||
return cls
|
return cls
|
||||||
|
|
||||||
@six.add_metaclass(MetaStep)
|
class Step(object, metaclass=MetaStep):
|
||||||
@six.add_metaclass(abc.ABCMeta)
|
|
||||||
class Step(object):
|
|
||||||
'Steps to set up a cross compiling gcc.'
|
'Steps to set up a cross compiling gcc.'
|
||||||
number = None
|
number = None
|
||||||
|
|
||||||
|
|||||||
@@ -69,8 +69,7 @@
|
|||||||
# upgraders in private branches.
|
# upgraders in private branches.
|
||||||
|
|
||||||
|
|
||||||
|
import configparser
|
||||||
from six.moves import configparser
|
|
||||||
import glob, types, sys, os
|
import glob, types, sys, os
|
||||||
import os.path as osp
|
import os.path as osp
|
||||||
|
|
||||||
|
|||||||
@@ -47,8 +47,6 @@ import os
|
|||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from six import add_metaclass
|
|
||||||
|
|
||||||
from . import style
|
from . import style
|
||||||
from . import sort_includes
|
from . import sort_includes
|
||||||
from .region import *
|
from .region import *
|
||||||
@@ -102,8 +100,7 @@ def _modified_regions(old, new):
|
|||||||
return regions
|
return regions
|
||||||
|
|
||||||
|
|
||||||
@add_metaclass(ABCMeta)
|
class Verifier(object, metaclass=ABCMeta):
|
||||||
class Verifier(object):
|
|
||||||
"""Base class for style verifiers
|
"""Base class for style verifiers
|
||||||
|
|
||||||
Verifiers check for style violations and optionally fix such
|
Verifiers check for style violations and optionally fix such
|
||||||
@@ -224,7 +221,6 @@ class Verifier(object):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@add_metaclass(ABCMeta)
|
|
||||||
class LineVerifier(Verifier):
|
class LineVerifier(Verifier):
|
||||||
def check(self, filename, regions=all_regions, fobj=None, silent=False):
|
def check(self, filename, regions=all_regions, fobj=None, silent=False):
|
||||||
close = False
|
close = False
|
||||||
|
|||||||
Reference in New Issue
Block a user