ruby: Fix regressions and make Ruby configs Python packages
This patch moves the addition of network options into the Ruby module to avoid the regressions all having to add it explicitly. Doing this exposes an issue in our current config system though, namely the fact that addtoPath is relative to the Python script being executed. Since both example and regression scripts use the Ruby module we would end up with two different (relative) paths being added. Instead we take a first step at turning the config modules into Python packages, simply by adding a __init__.py in the configs/ruby, configs/topologies and configs/network subdirectories. As a result, we can now add the top-level configs directory to the Python search path, and then use the package names in the various modules. The example scripts are also updated, and the messy path-deducing variations in the scripts are unified.
This commit is contained in:
@@ -34,13 +34,10 @@ from m5.defines import buildEnv
|
||||
from m5.util import addToPath
|
||||
import os, optparse, sys
|
||||
addToPath('../common')
|
||||
addToPath('../ruby')
|
||||
addToPath('../network')
|
||||
addToPath('../topologies')
|
||||
addToPath('../')
|
||||
|
||||
import Options
|
||||
import Ruby
|
||||
import Network
|
||||
from ruby import Ruby
|
||||
|
||||
# Get paths we might need. It's expected this file is in m5/configs/example.
|
||||
config_path = os.path.dirname(os.path.abspath(__file__))
|
||||
@@ -65,7 +62,6 @@ parser.add_option("--percent-writes", type="int", default=100,
|
||||
# Add the ruby specific and protocol specific options
|
||||
#
|
||||
Ruby.define_options(parser)
|
||||
Network.define_options(parser)
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
if args:
|
||||
|
||||
Reference in New Issue
Block a user