From db89790e355ec79d25196e03ec7f7f44cbe3b302 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Tue, 29 May 2018 20:18:01 +0200
Subject: [PATCH 1/5] SConstruct: Use print as a function for python3
 compatibility

---
 SConstruct               | 12 ++++++------
 sys/scons/SConscript.gl  |  2 +-
 sys/scons/scons_utils.py | 20 ++++++++++----------
 tdm_update/SConstruct    |  4 ++--
 4 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/SConstruct b/SConstruct
index be36d16..b244cb6 100644
--- a/SConstruct
+++ b/SConstruct
@@ -147,13 +147,13 @@ if ( not ARGUMENTS.has_key( 'NOCONF' ) or ARGUMENTS['NOCONF'] != '1' ):
 		site_file = open(conf_filename, 'r')
 		p = pickle.Unpickler(site_file)
 		site_dict = p.load()
-		print 'Loading build configuration from ' + conf_filename + ':'
+		print('Loading build configuration from ' + conf_filename + ':')
 		for k, v in site_dict.items():
 			exec_cmd = k + '=\'' + v + '\''
-			print '  ' + exec_cmd
+			print('  ' + exec_cmd)
 			exec(exec_cmd)
 else:
-	print 'Site settings ignored'
+	print('Site settings ignored')
 
 # end site settings ------------------------------
 
@@ -161,7 +161,7 @@ else:
 
 for k in ARGUMENTS.keys():
 	exec_cmd = k + '=\'' + ARGUMENTS[k] + '\''
-	print 'Command line: ' + exec_cmd
+	print('Command line: ' + exec_cmd)
 	exec( exec_cmd )
 
 # stgatilov: avoid annoying human errors when you set target='x32'
@@ -279,7 +279,7 @@ elif ( BUILD == 'release' ):
 	if ( ID_MCHECK == '0' ):
 		ID_MCHECK = '2'
 else:
-	print 'Unknown build configuration ' + BUILD
+	print('Unknown build configuration ' + BUILD)
 	sys.exit(0)
 
 if ( GL_HARDLINK != '0' ):
@@ -313,7 +313,7 @@ g_env_base['LINKFLAGS'] += CORELINKFLAGS
 
 
 #if ( int(JOBS) > 1 ):
-#	print 'Using buffered process output'
+#	print('Using buffered process output')
 #	silent = False
 #	if ( SILENT == '1' ):
 #		silent = True
diff --git a/sys/scons/SConscript.gl b/sys/scons/SConscript.gl
index 20237a2..0dc96d6 100644
--- a/sys/scons/SConscript.gl
+++ b/sys/scons/SConscript.gl
@@ -46,7 +46,7 @@ def build_logfuncs(env, target, source):
 	
 	f_out.close()
 	
-	print 'Generated %s' % target[0]
+	print('Generated {0}'.format(target[0]))
 
 gl_env = g_env_base.Clone()
 gl_env.Append( CPPPATH = '#' )
diff --git a/sys/scons/scons_utils.py b/sys/scons/scons_utils.py
index 377562c..c2050e1 100644
--- a/sys/scons/scons_utils.py
+++ b/sys/scons/scons_utils.py
@@ -19,9 +19,9 @@ class idBuffering:
 		except OSError, x:
 			if x.errno != 10:
 				raise x
-			print 'OSError ignored on command: %s' % command_string
+			print('OSError ignored on command: {0}'.format(command_string))
 			retval = 0
-		print command_string
+		print(command_string)
 		if ( retval != 0 or not self.silent ):
 			sys.stdout.write( stdout.getvalue() )
 			sys.stderr.write( stderr.getvalue() )
@@ -30,7 +30,7 @@ class idBuffering:
 class idSetupBase:
 	
 	def SimpleCommand( self, cmd ):
-		print cmd
+		print(cmd)
 		ret = commands.getstatusoutput( cmd )
 		if ( len( ret[ 1 ] ) ):
 			sys.stdout.write( ret[ 1 ] )
@@ -40,7 +40,7 @@ class idSetupBase:
 		return ret[ 1 ]
 
 	def TrySimpleCommand( self, cmd ):
-		print cmd
+		print(cmd)
 		ret = commands.getstatusoutput( cmd )
 		sys.stdout.write( ret[ 1 ] )
 
@@ -101,17 +101,17 @@ class idSetupBase:
 def checkLDD( target, source, env ):
 	file = target[0]
 	if (not os.path.isfile(file.abspath)):
-		print('ERROR: CheckLDD: target %s not found\n' % target[0])
+		print('ERROR: CheckLDD: target {0} not found\n'.format(target[0]))
 		Exit(1)
 	( status, output ) = commands.getstatusoutput( 'ldd -r %s' % file )
 	if ( status != 0 ):
-		print 'ERROR: ldd command returned with exit code %d' % ldd_ret
+		print('ERROR: ldd command returned with exit code {0}'.format(ldd_ret))
 		os.system( 'rm %s' % target[ 0 ] )
 		sys.exit(1)
 	lines = string.split( output, '\n' )
 	have_undef = 0
 	for i_line in lines:
-		#print repr(i_line)
+		#print(repr(i_line))
 		regex = re.compile('undefined symbol: (.*)\t\\((.*)\\)')
 		if ( regex.match(i_line) ):
 			symbol = regex.sub('\\1', i_line)
@@ -120,8 +120,8 @@ def checkLDD( target, source, env ):
 			except:
 				have_undef = 1
 	if ( have_undef ):
-		print output
-		print "ERROR: undefined symbols"
+		print(output)
+		print("ERROR: undefined symbols")
 		os.system('rm %s' % target[0])
 		sys.exit(1)
 
@@ -131,7 +131,7 @@ def SharedLibrarySafe( env, target, source ):
 	return ret
 
 def NotImplementedStub( *whatever ):
-	print 'Not Implemented'
+	print('Not Implemented')
 	sys.exit( 1 )
 
 # --------------------------------------------------------------------
diff --git a/tdm_update/SConstruct b/tdm_update/SConstruct
index c01983c..48ca68d 100644
--- a/tdm_update/SConstruct
+++ b/tdm_update/SConstruct
@@ -105,7 +105,7 @@ MACOSX_TARGET_ARCH = 'i386'
 
 for k in ARGUMENTS.keys():
 	exec_cmd = k + '=\'' + ARGUMENTS[k] + '\''
-	print 'Command line: ' + exec_cmd
+	print('Command line: ' + exec_cmd)
 	exec( exec_cmd )
 
 # end command line settings ----------------------
@@ -188,7 +188,7 @@ elif ( BUILD == 'release' ):
 	# no-unsafe-math-optimizations: that should be on by default really. hit some wonko bugs in physics code because of that
 	OPTCPPFLAGS = [ '-O3', '-ffast-math', '-fno-unsafe-math-optimizations', '-fomit-frame-pointer' ]
 else:
-	print 'Unknown build configuration ' + BUILD
+	print('Unknown build configuration ' + BUILD)
 	sys.exit(0)
 
 # create the build environements
-- 
2.17.0

