diff options
author | Craig Rodrigues <rodrigc@FreeBSD.org> | 2017-03-09 22:40:59 -0800 |
---|---|---|
committer | Craig Rodrigues <rodrigc@FreeBSD.org> | 2017-03-09 22:40:59 -0800 |
commit | d81d03d05f50be1977d09edaf3c1e5dd3ad0e525 (patch) | |
tree | 364f0b203d4e86071c51c2e77576d39e1e2d0bbf /doc/user | |
parent | 60739d37ab45e3c2ed4b45594035a31aaabbe456 (diff) | |
download | scons-d81d03d05f50be1977d09edaf3c1e5dd3ad0e525.tar.gz |
Use print() function to fix py2/3
Diffstat (limited to 'doc/user')
-rw-r--r-- | doc/user/builders-writing.xml | 4 | ||||
-rw-r--r-- | doc/user/command-line.xml | 14 | ||||
-rw-r--r-- | doc/user/environments.xml | 30 | ||||
-rw-r--r-- | doc/user/misc.xml | 30 | ||||
-rw-r--r-- | doc/user/nodes.xml | 12 | ||||
-rw-r--r-- | doc/user/output.xml | 8 | ||||
-rw-r--r-- | doc/user/simple.xml | 6 |
7 files changed, 52 insertions, 52 deletions
diff --git a/doc/user/builders-writing.xml b/doc/user/builders-writing.xml index dec176a8..07f2dec6 100644 --- a/doc/user/builders-writing.xml +++ b/doc/user/builders-writing.xml @@ -1047,7 +1047,7 @@ def MakeWorkDir(workdir): <file name="SConscript"> import my_utils MakeWorkDir('/tmp/work') -print "build_id=" + my_utils.build_id() +print("build_id=" + my_utils.build_id()) </file> </scons_example> @@ -1060,7 +1060,7 @@ print "build_id=" + my_utils.build_id() <sconstruct> import my_utils -print "build_id=" + my_utils.build_id() +print("build_id=" + my_utils.build_id()) my_utils.MakeWorkDir('/tmp/work') </sconstruct> diff --git a/doc/user/command-line.xml b/doc/user/command-line.xml index 85c2da01..a4bbf215 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", GetOption('num_jobs')) </file> <file name="foo.in"> 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:", unknown.keys()) Exit(1) env.Program('foo.c') </file> @@ -1945,7 +1945,7 @@ foo.c <scons_example name="commandline_COMMAND_LINE_TARGETS"> <file name="SConstruct" printme="1"> if 'bar' in COMMAND_LINE_TARGETS: - print "Don't forget to copy `bar' to the archive!" + print("Don't forget to copy `bar' to the archive!") Default(Program('foo.c')) Program('bar.c') </file> @@ -2210,7 +2210,7 @@ prog2.c <file name="SConstruct" printme="1"> prog1 = Program('prog1.c') Default(prog1) -print "DEFAULT_TARGETS is", map(str, DEFAULT_TARGETS) +print("DEFAULT_TARGETS is", map(str, DEFAULT_TARGETS)) </file> <file name="prog1.c"> prog1.c @@ -2244,10 +2244,10 @@ prog1.c <file name="SConstruct" printme="1"> prog1 = Program('prog1.c') Default(prog1) -print "DEFAULT_TARGETS is now", map(str, DEFAULT_TARGETS) +print("DEFAULT_TARGETS is now", map(str, DEFAULT_TARGETS)) prog2 = Program('prog2.c') Default(prog2) -print "DEFAULT_TARGETS is now", map(str, DEFAULT_TARGETS) +print("DEFAULT_TARGETS is now", map(str, DEFAULT_TARGETS)) </file> <file name="prog1.c"> 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", map(str, BUILD_TARGETS)) </file> <file name="prog1.c"> prog1.c diff --git a/doc/user/environments.xml b/doc/user/environments.xml index 66abdccb..d1da3f9c 100644 --- a/doc/user/environments.xml +++ b/doc/user/environments.xml @@ -627,7 +627,7 @@ int main() { } <scons_example name="environments_ex6"> <file name="SConstruct" printme="1"> env = Environment() -print "CC is:", env['CC'] +print("CC is:", env['CC']) </file> </scons_example> @@ -658,7 +658,7 @@ print "CC is:", env['CC'] env = Environment(FOO = 'foo', BAR = 'bar') dict = env.Dictionary() for key in ['OBJSUFFIX', 'LIBSUFFIX', 'PROGSUFFIX']: - print "key = %s, value = %s" % (key, dict[key]) + print("key = %s, value = %s" % (key, dict[key])) </file> </scons_example> @@ -695,7 +695,7 @@ for key in ['OBJSUFFIX', 'LIBSUFFIX', 'PROGSUFFIX']: <sconstruct> env = Environment() for item in sorted(env.Dictionary().items()): - print "construction variable = '%s', value = '%s'" % item + print("construction variable = '%s', value = '%s'" % item) </sconstruct> </section> @@ -721,7 +721,7 @@ for item in sorted(env.Dictionary().items()): <sconstruct> env = Environment() -print "CC is:", env.subst('$CC') +print("CC is:", env.subst('$CC')) </sconstruct> <para> @@ -738,7 +738,7 @@ print "CC is:", env.subst('$CC') <sconstruct> env = Environment(CCFLAGS = '-DFOO') -print "CCCOM is:", env['CCCOM'] +print("CCCOM is:", env['CCCOM']) </sconstruct> <para> @@ -764,7 +764,7 @@ scons: `.' is up to date. <sconstruct> env = Environment(CCFLAGS = '-DFOO') -print "CCCOM is:", env.subst('$CCCOM') +print("CCCOM is:", env.subst('$CCCOM')) </sconstruct> <para> @@ -806,7 +806,7 @@ scons: `.' is up to date. <scons_example name="environments_missing1"> <file name="SConstruct" printme="1"> env = Environment() -print "value is:", env.subst( '->$MISSING<-' ) +print("value is:", env.subst( '->$MISSING<-' )) </file> </scons_example> @@ -834,7 +834,7 @@ print "value is:", env.subst( '->$MISSING<-' ) <file name="SConstruct" printme="1"> AllowSubstExceptions() env = Environment() -print "value is:", env.subst( '->$MISSING<-' ) +print("value is:", env.subst( '->$MISSING<-' )) </file> </scons_example> @@ -854,7 +854,7 @@ print "value is:", env.subst( '->$MISSING<-' ) <file name="SConstruct" printme="1"> AllowSubstExceptions(IndexError, NameError, ZeroDivisionError) env = Environment() -print "value is:", env.subst( '->${1 / 0}<-' ) +print("value is:", env.subst( '->${1 / 0}<-' )) </file> </scons_example> @@ -1216,7 +1216,7 @@ int main() { } <file name="SConstruct" printme="1"> env = Environment() env.Replace(NEW_VARIABLE = 'xyzzy') -print "NEW_VARIABLE =", env['NEW_VARIABLE'] +print("NEW_VARIABLE =", env['NEW_VARIABLE']) </file> </scons_example> @@ -1251,11 +1251,11 @@ print "NEW_VARIABLE =", env['NEW_VARIABLE'] <scons_example name="environments_Replace2"> <file name="SConstruct" printme="1"> env = Environment(CCFLAGS = '-DDEFINE1') -print "CCFLAGS =", env['CCFLAGS'] +print("CCFLAGS =", env['CCFLAGS']) env.Program('foo.c') env.Replace(CCFLAGS = '-DDEFINE2') -print "CCFLAGS =", env['CCFLAGS'] +print("CCFLAGS =", env['CCFLAGS']) env.Program('bar.c') </file> <file name="foo.c"> @@ -1375,7 +1375,7 @@ int main() { } <file name="SConstruct" printme="1"> env = Environment() env.Append(NEW_VARIABLE = 'added') -print "NEW_VARIABLE =", env['NEW_VARIABLE'] +print("NEW_VARIABLE =", env['NEW_VARIABLE']) </file> </scons_example> @@ -1475,7 +1475,7 @@ int main() { } <file name="SConstruct" printme="1"> env = Environment() env.Prepend(NEW_VARIABLE = 'added') -print "NEW_VARIABLE =", env['NEW_VARIABLE'] +print("NEW_VARIABLE =", env['NEW_VARIABLE']) </file> </scons_example> @@ -1650,7 +1650,7 @@ if len(sys.argv) > 1: else: keys = sorted(os.environ.keys()) for key in keys: - print " " + key + "=" + os.environ[key] + print(" " + key + "=" + os.environ[key]) </file> </scons_example> diff --git a/doc/user/misc.xml b/doc/user/misc.xml index 286963d2..16906398 100644 --- a/doc/user/misc.xml +++ b/doc/user/misc.xml @@ -212,7 +212,7 @@ SCons 1.0 or greater required, but you have SCons 0.98.5 <scons_example name="misc_Exit"> <file name="SConstruct" printme="1"> if ARGUMENTS.get('FUTURE'): - print "The FUTURE option is not supported yet!" + print("The FUTURE option is not supported yet!") Exit(2) env = Environment() env.Program('hello.c') @@ -268,9 +268,9 @@ hello.c <scons_example name="misc_FindFile1a"> <file name="SConstruct" printme="1"> # one directory -print FindFile('missing', '.') +print(FindFile('missing', '.')) t = FindFile('exists', '.') -print t.__class__, t +print(t.__class__, t) </file> <file name="exists"> 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)) </file> <file name="config.h"> exists @@ -320,7 +320,7 @@ exists # several directories includes = [ '.', 'include', 'src/include'] headers = [ 'nonesuch.h', 'config.h', 'private.h', 'dist.h'] -print FindFile(headers, includes) +print(FindFile(headers, includes)) </file> <file name="config.h"> exists @@ -350,9 +350,9 @@ exists <scons_example name="misc_FindFile1d"> <file name="SConstruct" printme="1"> -print FindFile('multiple', ['sub1', 'sub2', 'sub3']) -print FindFile('multiple', ['sub2', 'sub3', 'sub1']) -print FindFile('multiple', ['sub3', 'sub1', 'sub2']) +print(FindFile('multiple', ['sub1', 'sub2', 'sub3'])) +print(FindFile('multiple', ['sub2', 'sub3', 'sub1'])) +print(FindFile('multiple', ['sub3', 'sub1', 'sub2'])) </file> <directory name="sub1"></directory> <file name="sub1/multiple"> @@ -386,8 +386,8 @@ exists <file name="SConstruct" printme="1"> # Neither file exists, so build will fail Command('derived', 'leaf', 'cat >$TARGET $SOURCE') -print FindFile('leaf', '.') -print FindFile('derived', '.') +print(FindFile('leaf', '.')) +print(FindFile('derived', '.')) </file> </scons_example> @@ -399,8 +399,8 @@ print FindFile('derived', '.') <file name="SConstruct" printme="1"> # Only 'leaf' exists Command('derived', 'leaf', 'cat >$TARGET $SOURCE') -print FindFile('leaf', '.') -print FindFile('derived', '.') +print(FindFile('leaf', '.')) +print(FindFile('derived', '.')) </file> <file name="leaf"> leaf @@ -422,7 +422,7 @@ leaf <file name="SConstruct" printme="1"> # Only 'src/leaf' exists VariantDir('build', 'src') -print FindFile('leaf', 'build') +print(FindFile('leaf', 'build')) </file> <directory name="src"></directory> <file name="src/leaf"> @@ -507,7 +507,7 @@ objects = [ Program(objects) for object_file in objects: - print object_file.abspath + print(object_file.abspath) </file> <file name="prog1.c"> prog1.c @@ -548,7 +548,7 @@ objects = [ Program(objects) for object_file in Flatten(objects): - print object_file.abspath + print(object_file.abspath) </file> <file name="prog1.c"> prog1.c diff --git a/doc/user/nodes.xml b/doc/user/nodes.xml index a04b6adb..b17bb7cf 100644 --- a/doc/user/nodes.xml +++ b/doc/user/nodes.xml @@ -265,8 +265,8 @@ xyzzy = Entry('xyzzy') <file name="SConstruct" printme="1"> 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:", object_list[0]) +print("The program file is:", program_list[0]) </file> <file name="hello.c"> 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(program_name, "does not exist!") </file> <file name="hello.c"> int main() { printf("Hello, world!\n"); } @@ -374,7 +374,7 @@ int main() { printf("Hello, world!\n"); } <file name="SConstruct" printme="1"> env=Environment(VAR="value") n=File("foo.c") -print env.GetBuildPath([n, "sub/dir/$VAR"]) +print(env.GetBuildPath([n, "sub/dir/$VAR"])) </file> </scons_example> @@ -414,8 +414,8 @@ print env.GetBuildPath([n, "sub/dir/$VAR"]) <file name="SConstruct" printme="1"> hello_c = File('hello.c') contents = hello_c.read() -print "contents are:" -print contents +print("contents are:") +print(contents) </file> <file name="hello.c"> int main() { printf("Hello, world!\n"); } diff --git a/doc/user/output.xml b/doc/user/output.xml index 78dcca49..ca4707d1 100644 --- a/doc/user/output.xml +++ b/doc/user/output.xml @@ -622,7 +622,7 @@ import atexit def print_build_failures(): from SCons.Script import GetBuildFailures for bf in GetBuildFailures(): - print "%s failed: %s" % (bf.node, bf.errstr) + print("%s failed: %s" % (bf.node, bf.errstr)) atexit.register(print_build_failures) </file> </scons_example> @@ -701,10 +701,10 @@ def display_build_status(): Here you could do all kinds of complicated things.""" status, failures_message = build_status() if status == 'failed': - print "FAILED!!!!" # could display alert, ring bell, etc. + print("FAILED!!!!") # could display alert, ring bell, etc. elif status == 'ok': - print "Build succeeded." - print failures_message + print("Build succeeded.") + print(failures_message) atexit.register(display_build_status) </file> diff --git a/doc/user/simple.xml b/doc/user/simple.xml index a015c918..acc438b5 100644 --- a/doc/user/simple.xml +++ b/doc/user/simple.xml @@ -442,11 +442,11 @@ Program('hello.c') # "hello.c" is the source file. <scons_example name="simple_declarative"> <file name="SConstruct" printme="1"> -print "Calling Program('hello.c')" +print("Calling Program('hello.c')") Program('hello.c') -print "Calling Program('goodbye.c')" +print("Calling Program('goodbye.c')") Program('goodbye.c') -print "Finished calling Program()" +print("Finished calling Program()") </file> <file name="hello.c"> int main() { printf("Hello, world!\n"); } |