diff options
Diffstat (limited to 'src/python/m5/util/__init__.py')
-rw-r--r-- | src/python/m5/util/__init__.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/python/m5/util/__init__.py b/src/python/m5/util/__init__.py index 573674879..2ad9c5627 100644 --- a/src/python/m5/util/__init__.py +++ b/src/python/m5/util/__init__.py @@ -39,6 +39,8 @@ # # Authors: Nathan Binkert +from __future__ import print_function + import os import re import sys @@ -57,26 +59,26 @@ from sorteddict import SortedDict # ever happen regardless of what the user does (i.e., an acutal m5 # bug). def panic(fmt, *args): - print >>sys.stderr, 'panic:', fmt % args + print('panic:', fmt % args, file=sys.stderr) sys.exit(1) # fatal() should be called when the simulation cannot continue due to # some condition that is the user's fault (bad configuration, invalid # arguments, etc.) and not a simulator bug. def fatal(fmt, *args): - print >>sys.stderr, 'fatal:', fmt % args + print('fatal:', fmt % args, file=sys.stderr) sys.exit(1) # warn() should be called when the user should be warned about some condition # that may or may not be the user's fault, but that they should be made aware # of as it may affect the simulation or results. def warn(fmt, *args): - print >>sys.stderr, 'warn:', fmt % args + print('warn:', fmt % args, file=sys.stderr) # inform() should be called when the user should be informed about some # condition that they may be interested in. def inform(fmt, *args): - print >>sys.stdout, 'info:', fmt % args + print('info:', fmt % args, file=sys.stdout) class Singleton(type): def __call__(cls, *args, **kwargs): @@ -166,14 +168,14 @@ def printList(items, indent=4): line = ' ' * indent for i,item in enumerate(items): if len(line) + len(item) > 76: - print line + print(line) line = ' ' * indent if i < len(items) - 1: line += '%s, ' % item else: line += item - print line + print(line) def readCommand(cmd, **kwargs): """run the command cmd, read the results and return them |