summaryrefslogtreecommitdiff
path: root/src/python/m5/SimObject.py
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-03-05 22:05:47 -0800
committerGabe Black <gabeblack@google.com>2018-03-06 23:39:01 +0000
commit0bb50e6745b35c785c4d8051eb43f6bc419fb924 (patch)
tree97dfd086d6e4b3f4252aec459091ff6dad19f2b6 /src/python/m5/SimObject.py
parent10e5646dbbe46aa317ec568cb2a58968ca867575 (diff)
downloadgem5-0bb50e6745b35c785c4d8051eb43f6bc419fb924.tar.xz
scons: Switch from the print statement to the print function.
Starting with version 3, scons imposes using the print function instead of the print statement in code it processes. To get things building again, this change moves all python code within gem5 to use the function version. Another change by another author separately made this same change to the site_tools and site_init.py files. Change-Id: I2de7dc3b1be756baad6f60574c47c8b7e80ea3b0 Reviewed-on: https://gem5-review.googlesource.com/8761 Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com> Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/python/m5/SimObject.py')
-rw-r--r--src/python/m5/SimObject.py31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index 919c0e852..6e61961bd 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -43,6 +43,8 @@
# Andreas Hansson
# Andreas Sandberg
+from __future__ import print_function
+
import sys
from types import FunctionType, MethodType, ModuleType
from functools import wraps
@@ -768,8 +770,8 @@ module_init(py::module &m_internal)
try:
ptypes = [p.ptype for p in params]
except:
- print cls, p, p.ptype_str
- print params
+ print(cls, p, p.ptype_str)
+ print(params)
raise
class_path = cls._value_dict['cxx_class'].split('::')
@@ -962,7 +964,7 @@ class SimObject(object):
def enumerateParams(self, flags_dict = {},
cmd_line_str = "", access_str = ""):
if hasattr(self, "_paramEnumed"):
- print "Cycle detected enumerating params"
+ print("Cycle detected enumerating params")
else:
self._paramEnumed = True
# Scan the children first to pick up all the objects in this SimObj
@@ -1334,8 +1336,8 @@ class SimObject(object):
try:
value = value.unproxy(self)
except:
- print "Error in unproxying param '%s' of %s" % \
- (param, self.path())
+ print("Error in unproxying param '%s' of %s" %
+ (param, self.path()))
raise
setattr(self, param, value)
@@ -1349,30 +1351,31 @@ class SimObject(object):
port.unproxy(self)
def print_ini(self, ini_file):
- print >>ini_file, '[' + self.path() + ']' # .ini section header
+ print('[' + self.path() + ']', file=ini_file) # .ini section header
instanceDict[self.path()] = self
if hasattr(self, 'type'):
- print >>ini_file, 'type=%s' % self.type
+ print('type=%s' % self.type, file=ini_file)
if len(self._children.keys()):
- print >>ini_file, 'children=%s' % \
- ' '.join(self._children[n].get_name() \
- for n in sorted(self._children.keys()))
+ print('children=%s' %
+ ' '.join(self._children[n].get_name()
+ for n in sorted(self._children.keys())),
+ file=ini_file)
for param in sorted(self._params.keys()):
value = self._values.get(param)
if value != None:
- print >>ini_file, '%s=%s' % (param,
- self._values[param].ini_str())
+ print('%s=%s' % (param, self._values[param].ini_str()),
+ file=ini_file)
for port_name in sorted(self._ports.keys()):
port = self._port_refs.get(port_name, None)
if port != None:
- print >>ini_file, '%s=%s' % (port_name, port.ini_str())
+ print('%s=%s' % (port_name, port.ini_str()), file=ini_file)
- print >>ini_file # blank line between objects
+ print(file=ini_file) # blank line between objects
# generate a tree of dictionaries expressing all the parameters in the
# instantiated system for use by scripts that want to do power, thermal