python: Enforce absolute imports for Python 3 compatibility
Change-Id: Ia88d7fd472f7aed9b97df81468211384981bf6c6 Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-on: https://gem5-review.googlesource.com/c/15983 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
This commit is contained in:
@@ -29,7 +29,7 @@
|
||||
# Ivan Pizarro
|
||||
|
||||
from m5.params import *
|
||||
from MemObject import MemObject
|
||||
from m5.objects.MemObject import MemObject
|
||||
|
||||
class BaseTLB(MemObject):
|
||||
type = 'BaseTLB'
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
#
|
||||
# Authors: Nathan Binkert
|
||||
|
||||
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.
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
# Andreas Sandberg
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
import sys
|
||||
from types import FunctionType, MethodType, ModuleType
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
#
|
||||
# Authors: Nathan Binkert
|
||||
|
||||
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.
|
||||
@@ -42,14 +45,14 @@ except ImportError:
|
||||
in_gem5 = False
|
||||
|
||||
if in_gem5:
|
||||
import SimObject
|
||||
import core
|
||||
import objects
|
||||
import params
|
||||
import stats
|
||||
import util
|
||||
from . import SimObject
|
||||
from . import core
|
||||
from . import objects
|
||||
from . import params
|
||||
from . import stats
|
||||
from . import util
|
||||
|
||||
from event import *
|
||||
from main import main
|
||||
from simulate import *
|
||||
from .event import *
|
||||
from .main import main
|
||||
from .simulate import *
|
||||
|
||||
|
||||
@@ -26,4 +26,7 @@
|
||||
#
|
||||
# Authors: Nathan Binkert
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
from _m5.core import setOutputDir
|
||||
|
||||
@@ -36,3 +36,6 @@
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
# Authors: Glenn Bergmans
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
@@ -19,6 +19,9 @@ Device Tree Blob Parser
|
||||
@author: Neil 'superna' Armstrong <superna9999@gmail.com>
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
import string
|
||||
import os
|
||||
import json
|
||||
|
||||
@@ -38,6 +38,9 @@
|
||||
#
|
||||
# Authors: Nathan Binkert
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
import inspect
|
||||
import _m5
|
||||
|
||||
|
||||
@@ -54,8 +54,8 @@ brief_copyright=\
|
||||
"gem5 is copyrighted software; use the --copyright option for details."
|
||||
|
||||
def parse_options():
|
||||
import config
|
||||
from options import OptionParser
|
||||
from . import config
|
||||
from .options import OptionParser
|
||||
|
||||
options = OptionParser(usage=usage, version=version,
|
||||
description=brief_copyright)
|
||||
@@ -203,15 +203,15 @@ def _check_tracing():
|
||||
def main(*args):
|
||||
import m5
|
||||
|
||||
import core
|
||||
import debug
|
||||
import defines
|
||||
import event
|
||||
import info
|
||||
import stats
|
||||
import trace
|
||||
from . import core
|
||||
from . import debug
|
||||
from . import defines
|
||||
from . import event
|
||||
from . import info
|
||||
from . import stats
|
||||
from . import trace
|
||||
|
||||
from util import inform, fatal, panic, isInteractive
|
||||
from .util import inform, fatal, panic, isInteractive
|
||||
|
||||
if len(args) == 0:
|
||||
options, arguments = parse_options()
|
||||
@@ -286,7 +286,7 @@ def main(*args):
|
||||
debug.help()
|
||||
|
||||
if options.list_sim_objects:
|
||||
import SimObject
|
||||
from . import SimObject
|
||||
done = True
|
||||
print("SimObjects:")
|
||||
objects = list(SimObject.allClasses.keys())
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
#
|
||||
# Authors: Nathan Binkert
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
from m5.internal import params
|
||||
from m5.SimObject import *
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@
|
||||
#
|
||||
# Authors: Nathan Binkert
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
import optparse
|
||||
import sys
|
||||
|
||||
|
||||
@@ -68,9 +68,9 @@ import sys
|
||||
import time
|
||||
import math
|
||||
|
||||
import proxy
|
||||
import ticks
|
||||
from util import *
|
||||
from . import proxy
|
||||
from . import ticks
|
||||
from .util import *
|
||||
|
||||
def isSimObject(*args, **kwargs):
|
||||
return SimObject.isSimObject(*args, **kwargs)
|
||||
@@ -2159,4 +2159,4 @@ __all__ = ['Param', 'VectorParam',
|
||||
'MasterPort', 'SlavePort',
|
||||
'VectorMasterPort', 'VectorSlavePort']
|
||||
|
||||
import SimObject
|
||||
from . import SimObject
|
||||
|
||||
@@ -45,9 +45,12 @@
|
||||
#
|
||||
#####################################################################
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
import copy
|
||||
|
||||
import params
|
||||
from . import params
|
||||
|
||||
class BaseProxy(object):
|
||||
def __init__(self, search_self, search_up):
|
||||
|
||||
@@ -51,14 +51,14 @@ import _m5.drain
|
||||
import _m5.core
|
||||
from _m5.stats import updateEvents as updateStatEvents
|
||||
|
||||
import stats
|
||||
import SimObject
|
||||
import ticks
|
||||
import objects
|
||||
from . import stats
|
||||
from . import SimObject
|
||||
from . import ticks
|
||||
from . import objects
|
||||
from m5.util.dot_writer import do_dot, do_dvfs_dot
|
||||
|
||||
from util import fatal
|
||||
from util import attrdict
|
||||
from .util import fatal
|
||||
from .util import attrdict
|
||||
|
||||
# define a MaxTick parameter, unsigned 64 bit
|
||||
MaxTick = 2**64 - 1
|
||||
|
||||
@@ -26,5 +26,8 @@
|
||||
#
|
||||
# Authors: Nathan Binkert
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
# Export native methods to Python
|
||||
from _m5.trace import output, ignore, disable, enable
|
||||
|
||||
@@ -45,14 +45,14 @@ import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
import convert
|
||||
import jobfile
|
||||
from . import convert
|
||||
from . import jobfile
|
||||
|
||||
from attrdict import attrdict, multiattrdict, optiondict
|
||||
from code_formatter import code_formatter
|
||||
from multidict import multidict
|
||||
from smartdict import SmartDict
|
||||
from sorteddict import SortedDict
|
||||
from .attrdict import attrdict, multiattrdict, optiondict
|
||||
from .code_formatter import code_formatter
|
||||
from .multidict import multidict
|
||||
from .smartdict import SmartDict
|
||||
from .sorteddict import SortedDict
|
||||
|
||||
# panic() should be called when something happens that should never
|
||||
# ever happen regardless of what the user does (i.e., an acutal m5
|
||||
|
||||
@@ -279,7 +279,7 @@ class code_formatter(object):
|
||||
__all__ = [ "code_formatter" ]
|
||||
|
||||
if __name__ == '__main__':
|
||||
from code_formatter import code_formatter
|
||||
from .code_formatter import code_formatter
|
||||
f = code_formatter()
|
||||
|
||||
class Foo(dict):
|
||||
|
||||
@@ -57,6 +57,9 @@
|
||||
#
|
||||
#####################################################################
|
||||
|
||||
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
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
# Authors: Nathan Binkert
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
@@ -35,6 +35,9 @@
|
||||
#
|
||||
# Authors: Andreas Sandberg
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
from abc import *
|
||||
|
||||
class PyBindExport(object):
|
||||
|
||||
@@ -41,9 +41,11 @@
|
||||
# rather than a normal value, and (c) coerce values written to the
|
||||
# dict to be strings.
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
from convert import *
|
||||
from attrdict import attrdict
|
||||
from .convert import *
|
||||
from .attrdict import attrdict
|
||||
|
||||
class Variable(str):
|
||||
"""Intelligent proxy class for SmartDict. Variable will use the
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
from bisect import bisect_left, bisect_right
|
||||
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
# Author: Steve Reinhardt
|
||||
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
Reference in New Issue
Block a user