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>
This commit is contained in:
Gabe Black
2018-03-05 22:05:47 -08:00
parent 10e5646dbb
commit 0bb50e6745
33 changed files with 386 additions and 318 deletions

View File

@@ -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