config: ruby: Get rid of an "eval" and an "exec" operating on generated code.
We can get the same result using importlib.
This commit is contained in:
parent
2d2a5aa410
commit
12243a3835
1 changed files with 7 additions and 6 deletions
|
@ -39,6 +39,7 @@
|
||||||
#
|
#
|
||||||
# Authors: Brad Beckmann
|
# Authors: Brad Beckmann
|
||||||
|
|
||||||
|
import importlib
|
||||||
import math
|
import math
|
||||||
import m5
|
import m5
|
||||||
from m5.objects import *
|
from m5.objects import *
|
||||||
|
@ -182,15 +183,15 @@ def create_system(options, full_system, system, piobus = None, dma_ports = []):
|
||||||
routers = [], ext_links = [], int_links = [], netifs = [])
|
routers = [], ext_links = [], int_links = [], netifs = [])
|
||||||
ruby.network = network
|
ruby.network = network
|
||||||
|
|
||||||
protocol = buildEnv['PROTOCOL']
|
protocol_name = buildEnv['PROTOCOL']
|
||||||
exec "import %s" % protocol
|
protocol = importlib.import_module(protocol_name)
|
||||||
try:
|
try:
|
||||||
(cpu_sequencers, dir_cntrls, topology) = \
|
(cpu_sequencers, dir_cntrls, topology) = \
|
||||||
eval("%s.create_system(options, full_system, system, dma_ports,\
|
protocol.create_system(options, full_system, system, dma_ports,
|
||||||
ruby)"
|
ruby)
|
||||||
% protocol)
|
|
||||||
except:
|
except:
|
||||||
print "Error: could not create sytem for ruby protocol %s" % protocol
|
print "Error: could not create sytem for ruby protocol %s" % \
|
||||||
|
protocol_name
|
||||||
raise
|
raise
|
||||||
|
|
||||||
# Create a port proxy for connecting the system port. This is
|
# Create a port proxy for connecting the system port. This is
|
||||||
|
|
Loading…
Reference in a new issue