configs: Fix relative import in non-package in configs
Fix "ValueError: Attempted relative import in non-package"
Python "compilation" fails when running, among other configs:
./build/X86/gem5.fast ./configs/example/ruby_random_test.py
The files in the configs/folder_name folder that are not named
"folder_name.py" are not packages, and thus Python does not allow
relative imports in them.
This fixes the bug reported in
https://gem5.atlassian.net/projects/GEM5/issues/GEM5-188
Change-Id: Ic8befc30e4cff1d6e8d2f5db1b7f9b89b0fc1395
Signed-off-by: Daniel R. Carvalho <odanrc@yahoo.com.br>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24163
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
committed by
Daniel Carvalho
parent
10833b50fe
commit
61cfc6d4ce
@@ -27,7 +27,7 @@
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
from .SysPaths import script, disk, binary
|
||||
from common.SysPaths import script, disk, binary
|
||||
from os import environ as env
|
||||
from m5.defines import buildEnv
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ from __future__ import absolute_import
|
||||
|
||||
import m5
|
||||
from m5.objects import *
|
||||
from .Caches import *
|
||||
from common.Caches import *
|
||||
from common import ObjectList
|
||||
|
||||
def config_cache(options, system):
|
||||
|
||||
@@ -43,8 +43,8 @@ from __future__ import absolute_import
|
||||
import m5
|
||||
from m5.objects import *
|
||||
from m5.util import *
|
||||
from .Benchmarks import *
|
||||
from . import ObjectList
|
||||
from common.Benchmarks import *
|
||||
from common import ObjectList
|
||||
|
||||
# Populate to reflect supported os types per target ISA
|
||||
os_types = { 'mips' : [ 'linux' ],
|
||||
|
||||
@@ -38,7 +38,7 @@ from __future__ import absolute_import
|
||||
|
||||
import m5.objects
|
||||
from common import ObjectList
|
||||
from . import HMC
|
||||
from common import HMC
|
||||
|
||||
def create_mem_ctrl(cls, r, i, nbr_mem_ctrls, intlv_bits, intlv_size):
|
||||
"""
|
||||
|
||||
@@ -43,8 +43,8 @@ import m5
|
||||
from m5.defines import buildEnv
|
||||
from m5.objects import *
|
||||
|
||||
from .Benchmarks import *
|
||||
from . import ObjectList
|
||||
from common.Benchmarks import *
|
||||
from common import ObjectList
|
||||
|
||||
vio_9p_help = """\
|
||||
Enable the Virtio 9P device and set the path to share. The default 9p path is
|
||||
@@ -407,7 +407,7 @@ def addSEOptions(parser):
|
||||
|
||||
|
||||
def addFSOptions(parser):
|
||||
from .FSConfig import os_types
|
||||
from common.FSConfig import os_types
|
||||
|
||||
# Simulation options
|
||||
parser.add_option("--timesync", action="store_true",
|
||||
|
||||
@@ -45,7 +45,7 @@ from os import getcwd
|
||||
from os.path import join as joinpath
|
||||
|
||||
from common import CpuConfig
|
||||
from . import ObjectList
|
||||
from common import ObjectList
|
||||
|
||||
import m5
|
||||
from m5.defines import buildEnv
|
||||
|
||||
@@ -34,8 +34,8 @@ import m5
|
||||
from m5.objects import *
|
||||
from m5.defines import buildEnv
|
||||
from m5.util import addToPath
|
||||
from .Ruby import create_topology
|
||||
from .Ruby import send_evicts
|
||||
from Ruby import create_topology
|
||||
from Ruby import send_evicts
|
||||
|
||||
addToPath('../')
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ import math
|
||||
import m5
|
||||
from m5.objects import *
|
||||
from m5.defines import buildEnv
|
||||
from .Ruby import create_topology, create_directories
|
||||
from .Ruby import send_evicts
|
||||
from Ruby import create_topology, create_directories
|
||||
from Ruby import send_evicts
|
||||
|
||||
#
|
||||
# Declare caches used by the protocol
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
from __future__ import print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
from .BaseTopology import BaseTopology
|
||||
from topologies.BaseTopology import BaseTopology
|
||||
|
||||
class Cluster(BaseTopology):
|
||||
""" A cluster is a group of nodes which are all one hop from eachother
|
||||
|
||||
@@ -30,7 +30,7 @@ from __future__ import absolute_import
|
||||
from m5.params import *
|
||||
from m5.objects import *
|
||||
|
||||
from .BaseTopology import SimpleTopology
|
||||
from topologies.BaseTopology import SimpleTopology
|
||||
|
||||
class Crossbar(SimpleTopology):
|
||||
description='Crossbar'
|
||||
|
||||
@@ -30,7 +30,7 @@ from __future__ import absolute_import
|
||||
from m5.params import *
|
||||
from m5.objects import *
|
||||
|
||||
from .BaseTopology import SimpleTopology
|
||||
from topologies.BaseTopology import SimpleTopology
|
||||
|
||||
class CrossbarGarnet(SimpleTopology):
|
||||
description='CrossbarGarnet'
|
||||
|
||||
@@ -32,7 +32,7 @@ from m5.objects import *
|
||||
|
||||
from common import FileSystemConfig
|
||||
|
||||
from .BaseTopology import SimpleTopology
|
||||
from topologies.BaseTopology import SimpleTopology
|
||||
|
||||
# Creates a Mesh topology with 4 directories, one at each corner.
|
||||
# One L1 (and L2, depending on the protocol) are connected to each router.
|
||||
|
||||
@@ -33,7 +33,7 @@ from m5.objects import *
|
||||
|
||||
from common import FileSystemConfig
|
||||
|
||||
from .BaseTopology import SimpleTopology
|
||||
from topologies.BaseTopology import SimpleTopology
|
||||
|
||||
# Creates a generic Mesh assuming an equal number of cache
|
||||
# and directory controllers.
|
||||
|
||||
@@ -31,7 +31,7 @@ from __future__ import absolute_import
|
||||
from m5.params import *
|
||||
from m5.objects import *
|
||||
|
||||
from .BaseTopology import SimpleTopology
|
||||
from topologies.BaseTopology import SimpleTopology
|
||||
|
||||
# Creates a generic Mesh assuming an equal number of cache
|
||||
# and directory controllers.
|
||||
|
||||
@@ -31,7 +31,7 @@ from __future__ import absolute_import
|
||||
from m5.params import *
|
||||
from m5.objects import *
|
||||
|
||||
from .BaseTopology import SimpleTopology
|
||||
from topologies.BaseTopology import SimpleTopology
|
||||
|
||||
class Pt2Pt(SimpleTopology):
|
||||
description='Pt2Pt'
|
||||
|
||||
Reference in New Issue
Block a user