From afcf2d70e7a55e3e91df82f789f059657caad850 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Mon, 13 Nov 2017 16:39:43 -0500 Subject: Fixed print statement to work with py2/3 --- doc/user/command-line.xml | 12 ++++++------ doc/user/environments.xml | 24 ++++++++++++------------ doc/user/misc.xml | 6 +++--- doc/user/nodes.xml | 6 +++--- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/doc/user/command-line.xml b/doc/user/command-line.xml index a4bbf21..f26c179 100644 --- a/doc/user/command-line.xml +++ b/doc/user/command-line.xml @@ -317,7 +317,7 @@ if not GetOption('help'): import os num_cpu = int(os.environ.get('NUM_CPU', 2)) SetOption('num_jobs', num_cpu) -print("running with -j", GetOption('num_jobs')) +print("running with -j %s"%GetOption('num_jobs')) foo.in @@ -1863,7 +1863,7 @@ env = Environment(variables = vars, CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'}) unknown = vars.UnknownVariables() if unknown: - print("Unknown variables:", unknown.keys()) + print("Unknown variables: %s"%unknown.keys()) Exit(1) env.Program('foo.c') @@ -2210,7 +2210,7 @@ prog2.c prog1 = Program('prog1.c') Default(prog1) -print("DEFAULT_TARGETS is", map(str, DEFAULT_TARGETS)) +print("DEFAULT_TARGETS is %s"%map(str, DEFAULT_TARGETS)) prog1.c @@ -2244,10 +2244,10 @@ prog1.c prog1 = Program('prog1.c') Default(prog1) -print("DEFAULT_TARGETS is now", map(str, DEFAULT_TARGETS)) +print("DEFAULT_TARGETS is now %s"%map(str, DEFAULT_TARGETS)) prog2 = Program('prog2.c') Default(prog2) -print("DEFAULT_TARGETS is now", map(str, DEFAULT_TARGETS)) +print("DEFAULT_TARGETS is now %s"%map(str, DEFAULT_TARGETS)) prog1.c @@ -2338,7 +2338,7 @@ else: prog1 = Program('prog1.c') Program('prog2.c') Default(prog1) -print("BUILD_TARGETS is", map(str, BUILD_TARGETS)) +print ("BUILD_TARGETS is %s"%map(str, BUILD_TARGETS)) prog1.c diff --git a/doc/user/environments.xml b/doc/user/environments.xml index ae670a8..2089dfe 100644 --- a/doc/user/environments.xml +++ b/doc/user/environments.xml @@ -627,7 +627,7 @@ int main() { } env = Environment() -print("CC is:", env['CC']) +print("CC is: %s"%env['CC']) @@ -721,7 +721,7 @@ for item in sorted(env.Dictionary().items()): env = Environment() -print("CC is:", env.subst('$CC')) +print("CC is: %s"%env.subst('$CC')) @@ -738,7 +738,7 @@ print("CC is:", env.subst('$CC')) env = Environment(CCFLAGS = '-DFOO') -print("CCCOM is:", env['CCCOM']) +print("CCCOM is: %s"%env['CCCOM']) @@ -764,7 +764,7 @@ scons: `.' is up to date. env = Environment(CCFLAGS = '-DFOO') -print("CCCOM is:", env.subst('$CCCOM')) +print("CCCOM is: %s"%env.subst('$CCCOM')) @@ -806,7 +806,7 @@ scons: `.' is up to date. env = Environment() -print("value is:", env.subst( '->$MISSING<-' )) +print("value is: %s"%env.subst( '->$MISSING<-' )) @@ -834,7 +834,7 @@ print("value is:", env.subst( '->$MISSING<-' )) AllowSubstExceptions() env = Environment() -print("value is:", env.subst( '->$MISSING<-' )) +print("value is: %s"%env.subst( '->$MISSING<-' )) @@ -854,7 +854,7 @@ print("value is:", env.subst( '->$MISSING<-' )) AllowSubstExceptions(IndexError, NameError, ZeroDivisionError) env = Environment() -print("value is:", env.subst( '->${1 / 0}<-' )) +print("value is: %s"%env.subst( '->${1 / 0}<-' )) @@ -1216,7 +1216,7 @@ int main() { } env = Environment() env.Replace(NEW_VARIABLE = 'xyzzy') -print("NEW_VARIABLE =", env['NEW_VARIABLE']) +print("NEW_VARIABLE = %s"%env['NEW_VARIABLE']) @@ -1251,11 +1251,11 @@ print("NEW_VARIABLE =", env['NEW_VARIABLE']) env = Environment(CCFLAGS = '-DDEFINE1') -print("CCFLAGS =", env['CCFLAGS']) +print("CCFLAGS = %s"%env['CCFLAGS']) env.Program('foo.c') env.Replace(CCFLAGS = '-DDEFINE2') -print("CCFLAGS =", env['CCFLAGS']) +print("CCFLAGS = %s"%env['CCFLAGS']) env.Program('bar.c') @@ -1375,7 +1375,7 @@ int main() { } env = Environment() env.Append(NEW_VARIABLE = 'added') -print("NEW_VARIABLE =", env['NEW_VARIABLE']) +print("NEW_VARIABLE = %s"%env['NEW_VARIABLE']) @@ -1475,7 +1475,7 @@ int main() { } env = Environment() env.Prepend(NEW_VARIABLE = 'added') -print("NEW_VARIABLE =", env['NEW_VARIABLE']) +print("NEW_VARIABLE = %s"%env['NEW_VARIABLE']) diff --git a/doc/user/misc.xml b/doc/user/misc.xml index 1690639..e390b7a 100644 --- a/doc/user/misc.xml +++ b/doc/user/misc.xml @@ -268,9 +268,9 @@ hello.c # one directory -print(FindFile('missing', '.')) +print("%s"%FindFile('missing', '.')) t = FindFile('exists', '.') -print(t.__class__, t) +print("%s %s"%(t.__class__, t)) exists @@ -287,7 +287,7 @@ print(t.__class__, t) includes = [ '.', 'include', 'src/include'] headers = [ 'nonesuch.h', 'config.h', 'private.h', 'dist.h'] for hdr in headers: - print('%-12s' % ('%s:' % hdr), FindFile(hdr, includes)) + print('%-12s: %s'%(hdr, FindFile(hdr, includes))) exists diff --git a/doc/user/nodes.xml b/doc/user/nodes.xml index b17bb7c..7d36a65 100644 --- a/doc/user/nodes.xml +++ b/doc/user/nodes.xml @@ -265,8 +265,8 @@ xyzzy = Entry('xyzzy') object_list = Object('hello.c') program_list = Program(object_list) -print("The object file is:", object_list[0]) -print("The program file is:", program_list[0]) +print("The object file is: %s"%object_list[0]) +print("The program file is: %s"%program_list[0]) int main() { printf("Hello, world!\n"); } @@ -334,7 +334,7 @@ import os.path program_list = Program('hello.c') program_name = str(program_list[0]) if not os.path.exists(program_name): - print(program_name, "does not exist!") + print("%s does not exist!"%program_name) int main() { printf("Hello, world!\n"); } -- cgit v0.12