summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorCraig Rodrigues <rodrigc@FreeBSD.org>2017-03-09 22:40:59 -0800
committerCraig Rodrigues <rodrigc@FreeBSD.org>2017-03-09 22:40:59 -0800
commitd81d03d05f50be1977d09edaf3c1e5dd3ad0e525 (patch)
tree364f0b203d4e86071c51c2e77576d39e1e2d0bbf /doc
parent60739d37ab45e3c2ed4b45594035a31aaabbe456 (diff)
downloadscons-d81d03d05f50be1977d09edaf3c1e5dd3ad0e525.tar.gz
Use print() function to fix py2/3
Diffstat (limited to 'doc')
-rw-r--r--doc/man/scons.xml36
-rw-r--r--doc/user/builders-writing.xml4
-rw-r--r--doc/user/command-line.xml14
-rw-r--r--doc/user/environments.xml30
-rw-r--r--doc/user/misc.xml30
-rw-r--r--doc/user/nodes.xml12
-rw-r--r--doc/user/output.xml8
-rw-r--r--doc/user/simple.xml6
8 files changed, 70 insertions, 70 deletions
diff --git a/doc/man/scons.xml b/doc/man/scons.xml
index 41ef607d..b68f27ae 100644
--- a/doc/man/scons.xml
+++ b/doc/man/scons.xml
@@ -2483,7 +2483,7 @@ foo = Object('foo.c')
bar = Object('bar.c')
objects = ['begin.o'] + foo + ['middle.o'] + bar + ['end.o']
for object in objects:
- print str(object)
+ print(str(object))
</literallayout>
<para>Or you can use the
@@ -2497,7 +2497,7 @@ foo = Object('foo.c')
bar = Object('bar.c')
objects = Flatten(['begin.o', foo, 'middle.o', bar, 'end.o'])
for object in objects:
- print str(object)
+ print(str(object))
</literallayout>
<para>Note also that because Builder calls return
@@ -2541,7 +2541,7 @@ function:</para>
<literallayout class="monospaced">
bar_obj_list = env.StaticObject('bar.c', CPPDEFINES='-DBAR')
-print "The path to bar_obj is:", str(bar_obj_list[0])
+print("The path to bar_obj is:", str(bar_obj_list[0]))
</literallayout>
<para>Note again that because the Builder call returns a list,
@@ -2842,10 +2842,10 @@ of the tuple, respectively.</para>
<para>Example:</para>
<literallayout class="monospaced">
-print "first keyword, value =", ARGLIST[0][0], ARGLIST[0][1]
-print "second keyword, value =", ARGLIST[1][0], ARGLIST[1][1]
+print("first keyword, value =", ARGLIST[0][0], ARGLIST[0][1])
+print("second keyword, value =", ARGLIST[1][0], ARGLIST[1][1])
third_tuple = ARGLIST[2]
-print "third keyword, value =", third_tuple[0], third_tuple[1]
+print("third keyword, value =", third_tuple[0], third_tuple[1])
for key, value in ARGLIST:
# process key and value
</literallayout>
@@ -2913,7 +2913,7 @@ for additional information.</para>
<literallayout class="monospaced">
if 'foo' in BUILD_TARGETS:
- print "Don't forget to test the `foo' program!"
+ print("Don't forget to test the `foo' program!")
if 'special/program' in BUILD_TARGETS:
SConscript('special')
</literallayout>
@@ -2951,7 +2951,7 @@ is explicitly being built.</para>
<literallayout class="monospaced">
if 'foo' in COMMAND_LINE_TARGETS:
- print "Don't forget to test the `foo' program!"
+ print("Don't forget to test the `foo' program!")
if 'special/program' in COMMAND_LINE_TARGETS:
SConscript('special')
</literallayout>
@@ -2975,9 +2975,9 @@ function to get at the path name for each Node.</para>
<para>Example:</para>
<literallayout class="monospaced">
-print str(DEFAULT_TARGETS[0])
+print(str(DEFAULT_TARGETS[0]))
if 'foo' in map(str, DEFAULT_TARGETS):
- print "Don't forget to test the `foo' program!"
+ print("Don't forget to test the `foo' program!")
</literallayout>
</listitem>
</varlistentry>
@@ -2990,13 +2990,13 @@ list change on on each successive call to the
function:</para>
<literallayout class="monospaced">
-print map(str, DEFAULT_TARGETS) # originally []
+print(map(str, DEFAULT_TARGETS)) # originally []
Default('foo')
-print map(str, DEFAULT_TARGETS) # now a node ['foo']
+print(map(str, DEFAULT_TARGETS)) # now a node ['foo']
Default('bar')
-print map(str, DEFAULT_TARGETS) # now a node ['foo', 'bar']
+print(map(str, DEFAULT_TARGETS)) # now a node ['foo', 'bar']
Default(None)
-print map(str, DEFAULT_TARGETS) # back to []
+print(map(str, DEFAULT_TARGETS)) # back to []
</literallayout>
<para>Consequently, be sure to use
@@ -3525,7 +3525,7 @@ a shared library, only that the compilation (not link) succeeds.</para>
env = Environment()
conf = Configure( env )
if not conf.CheckCHeader( 'math.h' ):
- print 'We really need math.h!'
+ print('We really need math.h!')
Exit(1)
if conf.CheckLibWithHeader( 'qt', 'qapp.h', 'c++',
'QApplication qapp(0,0);' ):
@@ -3815,7 +3815,7 @@ int main(int argc, char **argv) {
env = Environment()
conf = Configure( env, custom_tests = { 'CheckQt' : CheckQt } )
if not conf.CheckQt('/usr/lib/qt'):
- print 'We really need qt!'
+ print('We really need qt!')
Exit(1)
env = conf.Finish()
</programlisting>
@@ -3995,7 +3995,7 @@ not configured.</para>
<literallayout class="monospaced">
env = Environment(variables=vars)
for key, value in vars.UnknownVariables():
- print "unknown variable: %s=%s" % (key, value)
+ print("unknown variable: %s=%s" % (key, value))
</literallayout>
</listitem>
@@ -4400,7 +4400,7 @@ File('foo.c').srcnode().path # source path of the given source file.
# Builders also return File objects:
foo = env.Program('foo.c')
-print "foo will be built in %s"%foo.path
+print("foo will be built in %s"%foo.path)
</literallayout>
<para>A
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&lt;-' )
+print("value is:", env.subst( '->$MISSING&lt;-' ))
</file>
</scons_example>
@@ -834,7 +834,7 @@ print "value is:", env.subst( '->$MISSING&lt;-' )
<file name="SConstruct" printme="1">
AllowSubstExceptions()
env = Environment()
-print "value is:", env.subst( '->$MISSING&lt;-' )
+print("value is:", env.subst( '->$MISSING&lt;-' ))
</file>
</scons_example>
@@ -854,7 +854,7 @@ print "value is:", env.subst( '->$MISSING&lt;-' )
<file name="SConstruct" printme="1">
AllowSubstExceptions(IndexError, NameError, ZeroDivisionError)
env = Environment()
-print "value is:", env.subst( '->${1 / 0}&lt;-' )
+print("value is:", env.subst( '->${1 / 0}&lt;-' ))
</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) &gt; 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"); }