From 0bb50e6745b35c785c4d8051eb43f6bc419fb924 Mon Sep 17 00:00:00 2001
From: Gabe Black <gabeblack@google.com>
Date: Mon, 5 Mar 2018 22:05:47 -0800
Subject: 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>
---
 src/mem/slicc/main.py | 6 ++++--
 src/mem/slicc/util.py | 4 +++-
 2 files changed, 7 insertions(+), 3 deletions(-)

(limited to 'src/mem/slicc')

diff --git a/src/mem/slicc/main.py b/src/mem/slicc/main.py
index 0b528d805..05a5cdb97 100644
--- a/src/mem/slicc/main.py
+++ b/src/mem/slicc/main.py
@@ -25,6 +25,8 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+from __future__ import print_function
+
 import os
 import sys
 
@@ -45,7 +47,7 @@ def eprint(format, *args):
     if args:
         format = format % args
 
-    print >>sys.stderr, format
+    print(format, file=sys.stderr)
 
 def main(args=None):
     import optparse
@@ -79,7 +81,7 @@ def main(args=None):
 
     if opts.print_files:
         for i in sorted(slicc.files()):
-            print '    %s' % i
+            print('    %s' % i)
     else:
         output("Processing AST...")
         slicc.process()
diff --git a/src/mem/slicc/util.py b/src/mem/slicc/util.py
index 83badf46d..3a0cf5f35 100644
--- a/src/mem/slicc/util.py
+++ b/src/mem/slicc/util.py
@@ -24,6 +24,8 @@
 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+from __future__ import print_function
+
 import os
 import sys
 
@@ -66,7 +68,7 @@ class Location(object):
         if args:
             message = message % args
         #raise Exception, "%s: Warning: %s" % (self, message)
-        print >>sys.stderr, "%s: Warning: %s" % (self, message)
+        print("%s: Warning: %s" % (self, message), file=sys.stderr)
 
     def error(self, message, *args):
         if args:
-- 
cgit v1.2.3