summaryrefslogtreecommitdiff
path: root/doc/user
diff options
context:
space:
mode:
authorDirk Baechle <dl9obn@darc.de>2013-10-06 18:48:36 +0200
committerDirk Baechle <dl9obn@darc.de>2013-10-06 18:48:36 +0200
commit4ebe99885427c680c151010a2d67b409983c15d9 (patch)
tree9925174da025eaecdd21eb8030c6136e831e48eb /doc/user
parentfaf5e9f6f0b488b774db4817166220cf21d2f497 (diff)
downloadscons-4ebe99885427c680c151010a2d67b409983c15d9.tar.gz
- additional corrections for left alignment
Diffstat (limited to 'doc/user')
-rw-r--r--doc/user/add-method.xml36
-rw-r--r--doc/user/builders-writing.xml44
-rw-r--r--doc/user/caching.xml22
-rw-r--r--doc/user/command-line.xml44
-rw-r--r--doc/user/depends.xml96
-rw-r--r--doc/user/environments.xml96
-rw-r--r--doc/user/less-simple.xml14
-rw-r--r--doc/user/misc.xml36
-rw-r--r--doc/user/nodes.xml8
-rw-r--r--doc/user/output.xml124
-rw-r--r--doc/user/scanners.xml28
-rw-r--r--doc/user/sconf.xml74
-rw-r--r--doc/user/variants.xml56
13 files changed, 335 insertions, 343 deletions
diff --git a/doc/user/add-method.xml b/doc/user/add-method.xml
index e94626bc..c50786cd 100644
--- a/doc/user/add-method.xml
+++ b/doc/user/add-method.xml
@@ -100,28 +100,28 @@ int main() { printf("Hello, world!\n"); }
<scons_example name="addmethod_ex2">
<file name="SConstruct" printme="1">
- def BuildTestProg(env, testfile, resourcefile, testdir="tests"):
- """Build the test program;
- prepends "test_" to src and target,
- and puts target into testdir."""
- srcfile = "test_%s.c" % testfile
- target = "%s/test_%s" % (testdir, testfile)
- if env['PLATFORM'] == 'win32':
- resfile = env.RES(resourcefile)
- p = env.Program(target, [srcfile, resfile])
- else:
- p = env.Program(target, srcfile)
- return p
- AddMethod(Environment, BuildTestProg)
-
- env = Environment()
- env.BuildTestProg('stuff', resourcefile='res.rc')
+def BuildTestProg(env, testfile, resourcefile, testdir="tests"):
+ """Build the test program;
+ prepends "test_" to src and target,
+ and puts target into testdir."""
+ srcfile = "test_%s.c" % testfile
+ target = "%s/test_%s" % (testdir, testfile)
+ if env['PLATFORM'] == 'win32':
+ resfile = env.RES(resourcefile)
+ p = env.Program(target, [srcfile, resfile])
+ else:
+ p = env.Program(target, srcfile)
+ return p
+AddMethod(Environment, BuildTestProg)
+
+env = Environment()
+env.BuildTestProg('stuff', resourcefile='res.rc')
</file>
<file name="test_stuff.c">
- int main() { printf("Hello, world!\n"); }
+int main() { printf("Hello, world!\n"); }
</file>
<file name="res.rc">
- res.rc
+res.rc
</file>
</scons_example>
diff --git a/doc/user/builders-writing.xml b/doc/user/builders-writing.xml
index 383823a3..e6e2aaf2 100644
--- a/doc/user/builders-writing.xml
+++ b/doc/user/builders-writing.xml
@@ -812,38 +812,38 @@ env.Foo('file')
<scons_example name="builderswriting_MY_EMITTER">
<file name="SConstruct" printme="1">
- bld = Builder(action = 'my_command $SOURCES &gt; $TARGET',
- suffix = '.foo',
- src_suffix = '.input',
- emitter = '$MY_EMITTER')
- def modify1(target, source, env):
- return target, source + ['modify1.in']
- def modify2(target, source, env):
- return target, source + ['modify2.in']
- env1 = Environment(BUILDERS = {'Foo' : bld},
- MY_EMITTER = modify1)
- env2 = Environment(BUILDERS = {'Foo' : bld},
- MY_EMITTER = modify2)
- env1.Foo('file1')
- env2.Foo('file2')
- import os
- env1['ENV']['PATH'] = env2['ENV']['PATH'] + os.pathsep + os.getcwd()
- env2['ENV']['PATH'] = env2['ENV']['PATH'] + os.pathsep + os.getcwd()
+bld = Builder(action = 'my_command $SOURCES &gt; $TARGET',
+ suffix = '.foo',
+ src_suffix = '.input',
+ emitter = '$MY_EMITTER')
+def modify1(target, source, env):
+ return target, source + ['modify1.in']
+def modify2(target, source, env):
+ return target, source + ['modify2.in']
+env1 = Environment(BUILDERS = {'Foo' : bld},
+ MY_EMITTER = modify1)
+env2 = Environment(BUILDERS = {'Foo' : bld},
+ MY_EMITTER = modify2)
+env1.Foo('file1')
+env2.Foo('file2')
+import os
+env1['ENV']['PATH'] = env2['ENV']['PATH'] + os.pathsep + os.getcwd()
+env2['ENV']['PATH'] = env2['ENV']['PATH'] + os.pathsep + os.getcwd()
</file>
<file name="file1.input">
- file1.input
+file1.input
</file>
<file name="file2.input">
- file2.input
+file2.input
</file>
<file name="modify1.in">
- modify1.input
+modify1.input
</file>
<file name="modify2.in">
- modify2.input
+modify2.input
</file>
<file name="my_command" chmod="0755">
- cat
+cat
</file>
</scons_example>
diff --git a/doc/user/caching.xml b/doc/user/caching.xml
index f7286539..9c66c318 100644
--- a/doc/user/caching.xml
+++ b/doc/user/caching.xml
@@ -424,20 +424,20 @@ Program('prog',
<scons_output_command>scons -Q - -random</scons_output_command>
</scons_output>
- We captured it directly here to guarantee a "random" order,
- guarding against the potential for - -random to happen
- to return things in the original sorted order.
+We captured it directly here to guarantee a "random" order,
+guarding against the potential for - -random to happen
+to return things in the original sorted order.
- -->
+-->
<screen>
- % <userinput>scons -Q --random</userinput>
- cc -o f3.o -c f3.c
- cc -o f1.o -c f1.c
- cc -o f5.o -c f5.c
- cc -o f2.o -c f2.c
- cc -o f4.o -c f4.c
- cc -o prog f1.o f2.o f3.o f4.o f5.o
+ % <userinput>scons -Q --random</userinput>
+ cc -o f3.o -c f3.c
+ cc -o f1.o -c f1.c
+ cc -o f5.o -c f5.c
+ cc -o f2.o -c f2.c
+ cc -o f4.o -c f4.c
+ cc -o prog f1.o f2.o f3.o f4.o f5.o
</screen>
<para>
diff --git a/doc/user/command-line.xml b/doc/user/command-line.xml
index d2e41462..f410b3ee 100644
--- a/doc/user/command-line.xml
+++ b/doc/user/command-line.xml
@@ -628,21 +628,21 @@ foo.in
<scons_example name="commandline_AddOption">
<file name="SConstruct" printme="1">
- AddOption('--prefix',
- dest='prefix',
- type='string',
- nargs=1,
- action='store',
- metavar='DIR',
- help='installation prefix')
-
- env = Environment(PREFIX = GetOption('prefix'))
-
- installed_foo = env.Install('$PREFIX/usr/bin', 'foo.in')
- Default(installed_foo)
+AddOption('--prefix',
+ dest='prefix',
+ type='string',
+ nargs=1,
+ action='store',
+ metavar='DIR',
+ help='installation prefix')
+
+env = Environment(PREFIX = GetOption('prefix'))
+
+installed_foo = env.Install('$PREFIX/usr/bin', 'foo.in')
+Default(installed_foo)
</file>
<file name="foo.in">
- foo.in
+foo.in
</file>
</scons_example>
@@ -1092,21 +1092,21 @@ RELEASE = 1
<scons_example name="commandline_Variables_custom_py_2">
<file name="SConstruct">
- vars = Variables('custom.py')
- vars.Add('RELEASE', 'Set to 1 to build for release', 0)
- env = Environment(variables = vars,
- CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'})
- env.Program(['foo.c', 'bar.c'])
- Help(vars.GenerateHelpText(env))
+ vars = Variables('custom.py')
+ vars.Add('RELEASE', 'Set to 1 to build for release', 0)
+ env = Environment(variables = vars,
+ CPPDEFINES={'RELEASE_BUILD' : '${RELEASE}'})
+ env.Program(['foo.c', 'bar.c'])
+ Help(vars.GenerateHelpText(env))
</file>
<file name="foo.c">
- foo.c
+foo.c
</file>
<file name="bar.c">
- bar.c
+bar.c
</file>
<file name="custom.py" printme="1">
- RELEASE = 0
+RELEASE = 0
</file>
</scons_example>
diff --git a/doc/user/depends.xml b/doc/user/depends.xml
index 2dd7ea6b..3882af77 100644
--- a/doc/user/depends.xml
+++ b/doc/user/depends.xml
@@ -657,7 +657,7 @@ def update_file():
f = open("test.txt","a")
f.write("some line\n")
f.close()
-
+
update_file()
# Activate our own decider function
@@ -1364,18 +1364,18 @@ cc -o hello hello.o
<scons_example name="depends_macroinc">
<file name="hello.c" printme="1">
- #define FOO_HEADER &lt;foo.h&gt;
- #include FOO_HEADER
+#define FOO_HEADER &lt;foo.h&gt;
+#include FOO_HEADER
- int main() {
- return FOO;
- }
+int main() {
+ return FOO;
+}
</file>
<file name="SConstruct">
- Program('hello', 'hello.c', CPPPATH='.')
+Program('hello', 'hello.c', CPPPATH='.')
</file>
<file name="foo.h">
- #define FOO 42
+#define FOO 42
</file>
</scons_example>
@@ -1416,24 +1416,24 @@ cc -o hello hello.o
<scons_example name="depends_parsedep">
<file name="hello.c">
- #define FOO_HEADER &lt;foo.h&gt;
- #include FOO_HEADER
+#define FOO_HEADER &lt;foo.h&gt;
+#include FOO_HEADER
- int main() {
- return FOO;
- }
+int main() {
+ return FOO;
+}
</file>
<file name="SConstruct" printme="1">
- obj = Object('hello.c', CCFLAGS='-MD -MF hello.d', CPPPATH='.')
- SideEffect('hello.d', obj)
- ParseDepends('hello.d')
- Program('hello', obj)
+obj = Object('hello.c', CCFLAGS='-MD -MF hello.d', CPPPATH='.')
+SideEffect('hello.d', obj)
+ParseDepends('hello.d')
+Program('hello', obj)
</file>
<file name="foo.h">
- #define FOO 42
+#define FOO 42
</file>
<file name="hello.d">
- hello.o: hello.c foo.h
+hello.o: hello.c foo.h
</file>
</scons_example>
@@ -1453,21 +1453,21 @@ cc -o hello hello.o
<scons_example name="depends_parsedeprebuild">
<file name="hello.c">
- #define FOO_HEADER &lt;foo.h&gt;
- #include FOO_HEADER
+#define FOO_HEADER &lt;foo.h&gt;
+#include FOO_HEADER
- int main() {
- return FOO;
- }
+int main() {
+ return FOO;
+}
</file>
<file name="SConstruct">
- obj = Object('hello.c', CCFLAGS='-MD -MF hello.d', CPPPATH='.')
- SideEffect('hello.d', obj)
- ParseDepends('hello.d')
- Program('hello', obj)
+obj = Object('hello.c', CCFLAGS='-MD -MF hello.d', CPPPATH='.')
+SideEffect('hello.d', obj)
+ParseDepends('hello.d')
+Program('hello', obj)
</file>
<file name="foo.h">
- #define FOO 42
+#define FOO 42
</file>
</scons_example>
@@ -1669,18 +1669,18 @@ int main() { printf("Hello!\n"); }
<scons_example name="depends_no-Requires">
<file name="SConstruct" printme="1">
- import time
+import time
- version_c_text = """
- char *date = "%s";
- """ % time.ctime(time.time())
- open('version.c', 'w').write(version_c_text)
+version_c_text = """
+char *date = "%s";
+""" % time.ctime(time.time())
+open('version.c', 'w').write(version_c_text)
- hello = Program(['hello.c', 'version.c'])
+hello = Program(['hello.c', 'version.c'])
</file>
<file name="hello.c">
- extern char *date;
- int main() { printf("Hello, %s! I was built: %s\n", date); }
+extern char *date;
+int main() { printf("Hello, %s! I was built: %s\n", date); }
</file>
</scons_example>
@@ -1728,23 +1728,23 @@ int main() { printf("Hello!\n"); }
<scons_example name="depends_Requires">
<file name="SConstruct" printme="1">
- import time
+import time
- version_c_text = """
- char *date = "%s";
- """ % time.ctime(time.time())
- open('version.c', 'w').write(version_c_text)
+version_c_text = """
+char *date = "%s";
+""" % time.ctime(time.time())
+open('version.c', 'w').write(version_c_text)
- version_obj = Object('version.c')
+version_obj = Object('version.c')
- hello = Program('hello.c',
- LINKFLAGS = str(version_obj[0]))
+hello = Program('hello.c',
+ LINKFLAGS = str(version_obj[0]))
- Requires(hello, version_obj)
+Requires(hello, version_obj)
</file>
<file name="hello.c">
- extern char *date;
- int main() { printf("Hello, %s! I was built: %s\n", date); }
+extern char *date;
+int main() { printf("Hello, %s! I was built: %s\n", date); }
</file>
</scons_example>
diff --git a/doc/user/environments.xml b/doc/user/environments.xml
index f11a95b6..b9585cb3 100644
--- a/doc/user/environments.xml
+++ b/doc/user/environments.xml
@@ -579,13 +579,13 @@ env = Environment()
<scons_example name="environments_ex1">
<file name="SConstruct" printme="1">
- env = Environment(CC = 'gcc',
- CCFLAGS = '-O2')
+ env = Environment(CC = 'gcc',
+ CCFLAGS = '-O2')
- env.Program('foo.c')
+ env.Program('foo.c')
</file>
<file name="foo.c">
- int main() { }
+int main() { }
</file>
</scons_example>
@@ -861,8 +861,6 @@ print "value is:", env.subst( '->${1 / 0}&lt;-' )
<scons_output example="environments_missing3" suffix="1">
<scons_output_command>scons -Q</scons_output_command>
</scons_output>
- <sconstruct>
- </sconstruct>
<para>
If &AllowSubstExceptions; is called multiple times, each call
@@ -903,9 +901,7 @@ print "value is:", env.subst( '->${1 / 0}&lt;-' )
</para>
<sconstruct>
-
- DefaultEnvironment(CC = '/usr/local/bin/gcc')
-
+DefaultEnvironment(CC = '/usr/local/bin/gcc')
</sconstruct>
<para>
@@ -937,10 +933,8 @@ print "value is:", env.subst( '->${1 / 0}&lt;-' )
</para>
<sconstruct>
-
- env = DefaultEnvironment()
- env['CC'] = '/usr/local/bin/gcc'
-
+env = DefaultEnvironment()
+env['CC'] = '/usr/local/bin/gcc'
</sconstruct>
<para>
@@ -966,10 +960,8 @@ print "value is:", env.subst( '->${1 / 0}&lt;-' )
</para>
<sconstruct>
-
- env = DefaultEnvironment(tools = ['gcc', 'gnulink'],
- CC = '/usr/local/bin/gcc')
-
+env = DefaultEnvironment(tools = ['gcc', 'gnulink'],
+ CC = '/usr/local/bin/gcc')
</sconstruct>
<para>
@@ -1005,18 +997,18 @@ print "value is:", env.subst( '->${1 / 0}&lt;-' )
<scons_example name="environments_ex2">
<file name="SConstruct" printme="1">
- opt = Environment(CCFLAGS = '-O2')
- dbg = Environment(CCFLAGS = '-g')
+opt = Environment(CCFLAGS = '-O2')
+dbg = Environment(CCFLAGS = '-g')
- opt.Program('foo', 'foo.c')
+opt.Program('foo', 'foo.c')
- dbg.Program('bar', 'bar.c')
+dbg.Program('bar', 'bar.c')
</file>
<file name="foo.c">
- int main() { }
+int main() { }
</file>
<file name="bar.c">
- int main() { }
+int main() { }
</file>
</scons_example>
@@ -1036,15 +1028,15 @@ print "value is:", env.subst( '->${1 / 0}&lt;-' )
<scons_example name="environments_ex3">
<file name="SConstruct" printme="1">
- opt = Environment(CCFLAGS = '-O2')
- dbg = Environment(CCFLAGS = '-g')
+opt = Environment(CCFLAGS = '-O2')
+dbg = Environment(CCFLAGS = '-g')
- opt.Program('foo', 'foo.c')
+opt.Program('foo', 'foo.c')
- dbg.Program('foo', 'foo.c')
+dbg.Program('foo', 'foo.c')
</file>
<file name="foo.c">
- int main() { }
+int main() { }
</file>
</scons_example>
@@ -1081,17 +1073,17 @@ print "value is:", env.subst( '->${1 / 0}&lt;-' )
<scons_example name="environments_ex4">
<file name="SConstruct" printme="1">
- opt = Environment(CCFLAGS = '-O2')
- dbg = Environment(CCFLAGS = '-g')
+opt = Environment(CCFLAGS = '-O2')
+dbg = Environment(CCFLAGS = '-g')
- o = opt.Object('foo-opt', 'foo.c')
- opt.Program(o)
+o = opt.Object('foo-opt', 'foo.c')
+opt.Program(o)
- d = dbg.Object('foo-dbg', 'foo.c')
- dbg.Program(d)
+d = dbg.Object('foo-dbg', 'foo.c')
+dbg.Program(d)
</file>
<file name="foo.c">
- int main() { }
+int main() { }
</file>
</scons_example>
@@ -1149,20 +1141,20 @@ print "value is:", env.subst( '->${1 / 0}&lt;-' )
<scons_example name="environments_ex5">
<file name="SConstruct" printme="1">
- env = Environment(CC = 'gcc')
- opt = env.Clone(CCFLAGS = '-O2')
- dbg = env.Clone(CCFLAGS = '-g')
+env = Environment(CC = 'gcc')
+opt = env.Clone(CCFLAGS = '-O2')
+dbg = env.Clone(CCFLAGS = '-g')
- env.Program('foo', 'foo.c')
+env.Program('foo', 'foo.c')
- o = opt.Object('foo-opt', 'foo.c')
- opt.Program(o)
+o = opt.Object('foo-opt', 'foo.c')
+opt.Program(o)
- d = dbg.Object('foo-dbg', 'foo.c')
- dbg.Program(d)
+d = dbg.Object('foo-dbg', 'foo.c')
+dbg.Program(d)
</file>
<file name="foo.c">
- int main() { }
+int main() { }
</file>
</scons_example>
@@ -1258,19 +1250,19 @@ print "NEW_VARIABLE =", env['NEW_VARIABLE']
<scons_example name="environments_Replace2">
<file name="SConstruct" printme="1">
- env = Environment(CCFLAGS = '-DDEFINE1')
- print "CCFLAGS =", env['CCFLAGS']
- env.Program('foo.c')
+env = Environment(CCFLAGS = '-DDEFINE1')
+print "CCFLAGS =", env['CCFLAGS']
+env.Program('foo.c')
- env.Replace(CCFLAGS = '-DDEFINE2')
- print "CCFLAGS =", env['CCFLAGS']
- env.Program('bar.c')
+env.Replace(CCFLAGS = '-DDEFINE2')
+print "CCFLAGS =", env['CCFLAGS']
+env.Program('bar.c')
</file>
<file name="foo.c">
- int main() { }
+int main() { }
</file>
<file name="bar.c">
- int main() { }
+int main() { }
</file>
</scons_example>
diff --git a/doc/user/less-simple.xml b/doc/user/less-simple.xml
index 4c60cc71..41a1f3d4 100644
--- a/doc/user/less-simple.xml
+++ b/doc/user/less-simple.xml
@@ -337,15 +337,15 @@ Program('program2', ['program2.c'])
</para>
<sconstruct>
- common_sources = ['file1.c', 'file2.c']
+common_sources = ['file1.c', 'file2.c']
- # THE FOLLOWING IS INCORRECT AND GENERATES A PYTHON ERROR
- # BECAUSE IT TRIES TO ADD A STRING TO A LIST:
- Program('program1', common_sources + 'program1.c')
+# THE FOLLOWING IS INCORRECT AND GENERATES A PYTHON ERROR
+# BECAUSE IT TRIES TO ADD A STRING TO A LIST:
+Program('program1', common_sources + 'program1.c')
- # The following works correctly, because it's adding two
- # lists together to make another list.
- Program('program2', common_sources + ['program2.c'])
+# The following works correctly, because it's adding two
+# lists together to make another list.
+Program('program2', common_sources + ['program2.c'])
</sconstruct>
</important>
diff --git a/doc/user/misc.xml b/doc/user/misc.xml
index 4145d49e..d0aeb59f 100644
--- a/doc/user/misc.xml
+++ b/doc/user/misc.xml
@@ -501,20 +501,20 @@ prog2.c
<scons_example name="misc_Flatten2">
<file name="SConstruct" printme="1">
- objects = [
- Object('prog1.c'),
- Object('prog2.c', CCFLAGS='-DFOO'),
- ]
- Program(objects)
+objects = [
+ Object('prog1.c'),
+ Object('prog2.c', CCFLAGS='-DFOO'),
+]
+Program(objects)
- for object_file in objects:
- print object_file.abspath
+for object_file in objects:
+ print object_file.abspath
</file>
<file name="prog1.c">
- prog1.c
+prog1.c
</file>
<file name="prog2.c">
- prog2.c
+prog2.c
</file>
</scons_example>
@@ -542,20 +542,20 @@ prog2.c
<scons_example name="misc_Flatten3">
<file name="SConstruct" printme="1">
- objects = [
- Object('prog1.c'),
- Object('prog2.c', CCFLAGS='-DFOO'),
- ]
- Program(objects)
+objects = [
+ Object('prog1.c'),
+ Object('prog2.c', CCFLAGS='-DFOO'),
+]
+Program(objects)
- for object_file in Flatten(objects):
- print object_file.abspath
+for object_file in Flatten(objects):
+ print object_file.abspath
</file>
<file name="prog1.c">
- prog1.c
+prog1.c
</file>
<file name="prog2.c">
- prog2.c
+prog2.c
</file>
</scons_example>
diff --git a/doc/user/nodes.xml b/doc/user/nodes.xml
index 78f15e32..1c9b4fd9 100644
--- a/doc/user/nodes.xml
+++ b/doc/user/nodes.xml
@@ -183,11 +183,11 @@ int main() { printf("Goodbye, world!\n"); }
<scons_example name="nodes_print">
<file name="SConstruct" printme="1">
- hello_c = File('hello.c')
- Program(hello_c)
+hello_c = File('hello.c')
+Program(hello_c)
- classes = Dir('classes')
- Java(classes, 'src')
+classes = Dir('classes')
+Java(classes, 'src')
</file>
</scons_example>
diff --git a/doc/user/output.xml b/doc/user/output.xml
index de6b8d4d..069d525a 100644
--- a/doc/user/output.xml
+++ b/doc/user/output.xml
@@ -132,12 +132,12 @@ Type: 'scons program' to build the production program,
<scons_example name="output_ex2">
<file name="SConstruct" printme="1">
- env = Environment()
+env = Environment()
- Help("\nType: 'scons program' to build the production program.\n")
+Help("\nType: 'scons program' to build the production program.\n")
- if env['PLATFORM'] == 'win32':
- Help("\nType: 'scons windebug' to build the Windows debug version.\n")
+if env['PLATFORM'] == 'win32':
+ Help("\nType: 'scons windebug' to build the Windows debug version.\n")
</file>
</scons_example>
@@ -522,13 +522,13 @@ Program('f2.c')
<scons_example name="output_Progress-callable">
<file name="SConstruct" printme="1">
- screen = open('/dev/tty', 'w')
- count = 0
- def progress_function(node)
- count += 1
- screen.write('Node %4d: %s\r' % (count, node))
+screen = open('/dev/tty', 'w')
+count = 0
+def progress_function(node)
+ count += 1
+ screen.write('Node %4d: %s\r' % (count, node))
- Progress(progress_function)
+Progress(progress_function)
</file>
</scons_example>
@@ -595,13 +595,13 @@ Program('f2.c')
<scons_example name="output_gbf1">
<file name="SConstruct" printme="1">
- import atexit
+import atexit
- def print_build_failures():
- from SCons.Script import GetBuildFailures
- for bf in GetBuildFailures():
- print "%s failed: %s" % (bf.node, bf.errstr)
- atexit.register(print_build_failures)
+def print_build_failures():
+ from SCons.Script import GetBuildFailures
+ for bf in GetBuildFailures():
+ print "%s failed: %s" % (bf.node, bf.errstr)
+atexit.register(print_build_failures)
</file>
</scons_example>
@@ -639,52 +639,52 @@ Program('f2.c')
<scons_example name="output_gbf2">
<file name="SConstruct" printme="1">
- # Make the build fail if we pass fail=1 on the command line
- if ARGUMENTS.get('fail', 0):
- Command('target', 'source', ['/bin/false'])
-
- def bf_to_str(bf):
- """Convert an element of GetBuildFailures() to a string
- in a useful way."""
- import SCons.Errors
- if bf is None: # unknown targets product None in list
- return '(unknown tgt)'
- elif isinstance(bf, SCons.Errors.StopError):
- return str(bf)
- elif bf.node:
- return str(bf.node) + ': ' + bf.errstr
- elif bf.filename:
- return bf.filename + ': ' + bf.errstr
- return 'unknown failure: ' + bf.errstr
- import atexit
-
- def build_status():
- """Convert the build status to a 2-tuple, (status, msg)."""
- from SCons.Script import GetBuildFailures
- bf = GetBuildFailures()
- if bf:
- # bf is normally a list of build failures; if an element is None,
- # it's because of a target that scons doesn't know anything about.
- status = 'failed'
- failures_message = "\n".join(["Failed building %s" % bf_to_str(x)
- for x in bf if x is not None])
- else:
- # if bf is None, the build completed successfully.
- status = 'ok'
- failures_message = ''
- return (status, failures_message)
-
- def display_build_status():
- """Display the build status. Called by atexit.
- 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.
- elif status == 'ok':
- print "Build succeeded."
- print failures_message
-
- atexit.register(display_build_status)
+# Make the build fail if we pass fail=1 on the command line
+if ARGUMENTS.get('fail', 0):
+ Command('target', 'source', ['/bin/false'])
+
+def bf_to_str(bf):
+ """Convert an element of GetBuildFailures() to a string
+ in a useful way."""
+ import SCons.Errors
+ if bf is None: # unknown targets product None in list
+ return '(unknown tgt)'
+ elif isinstance(bf, SCons.Errors.StopError):
+ return str(bf)
+ elif bf.node:
+ return str(bf.node) + ': ' + bf.errstr
+ elif bf.filename:
+ return bf.filename + ': ' + bf.errstr
+ return 'unknown failure: ' + bf.errstr
+import atexit
+
+def build_status():
+ """Convert the build status to a 2-tuple, (status, msg)."""
+ from SCons.Script import GetBuildFailures
+ bf = GetBuildFailures()
+ if bf:
+ # bf is normally a list of build failures; if an element is None,
+ # it's because of a target that scons doesn't know anything about.
+ status = 'failed'
+ failures_message = "\n".join(["Failed building %s" % bf_to_str(x)
+ for x in bf if x is not None])
+ else:
+ # if bf is None, the build completed successfully.
+ status = 'ok'
+ failures_message = ''
+ return (status, failures_message)
+
+def display_build_status():
+ """Display the build status. Called by atexit.
+ 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.
+ elif status == 'ok':
+ print "Build succeeded."
+ print failures_message
+
+atexit.register(display_build_status)
</file>
</scons_example>
diff --git a/doc/user/scanners.xml b/doc/user/scanners.xml
index 5ed0d625..758a8490 100644
--- a/doc/user/scanners.xml
+++ b/doc/user/scanners.xml
@@ -308,34 +308,34 @@ env.Append(SCANNERS = kscan)
<scons_example name="scanners_scan">
<file name="SConstruct" printme="1">
- import re
+ import re
- include_re = re.compile(r'^include\s+(\S+)$', re.M)
+ include_re = re.compile(r'^include\s+(\S+)$', re.M)
- def kfile_scan(node, env, path):
- contents = node.get_text_contents()
- includes = include_re.findall(contents)
- return env.File(includes)
+ def kfile_scan(node, env, path):
+ contents = node.get_text_contents()
+ includes = include_re.findall(contents)
+ return env.File(includes)
- kscan = Scanner(function = kfile_scan,
- skeys = ['.k'])
+ kscan = Scanner(function = kfile_scan,
+ skeys = ['.k'])
- env = Environment(ENV = {'PATH' : '__ROOT__/usr/local/bin'})
- env.Append(SCANNERS = kscan)
+ env = Environment(ENV = {'PATH' : '__ROOT__/usr/local/bin'})
+ env.Append(SCANNERS = kscan)
- env.Command('foo', 'foo.k', 'kprocess &lt; $SOURCES &gt; $TARGET')
+ env.Command('foo', 'foo.k', 'kprocess &lt; $SOURCES &gt; $TARGET')
</file>
<file name="foo.k">
- include other_file
+include other_file
</file>
<file name="other_file">
- other_file
+other_file
</file>
<directory name="__ROOT__/usr"></directory>
<directory name="__ROOT__/usr/local"></directory>
<directory name="__ROOT__/usr/local/bin"></directory>
<file name="__ROOT_/usr/local/bin/kprocess" chmod="755">
- cat
+cat
</file>
</scons_example>
diff --git a/doc/user/sconf.xml b/doc/user/sconf.xml
index e787db96..31bd45e0 100644
--- a/doc/user/sconf.xml
+++ b/doc/user/sconf.xml
@@ -303,20 +303,20 @@ env = conf.Finish()
</para>
<sconstruct>
- mylib_test_source_file = """
- #include &amp;lt;mylib.h&amp;gt;
- int main(int argc, char **argv)
- {
- MyLibrary mylib(argc, argv);
- return 0;
- }
- """
-
- def CheckMyLibrary(context):
- context.Message('Checking for MyLibrary...')
- result = context.TryLink(mylib_test_source_file, '.c')
- context.Result(result)
- return result
+mylib_test_source_file = """
+#include &amp;lt;mylib.h&amp;gt;
+int main(int argc, char **argv)
+{
+ MyLibrary mylib(argc, argv);
+ return 0;
+}
+"""
+
+def CheckMyLibrary(context):
+ context.Message('Checking for MyLibrary...')
+ result = context.TryLink(mylib_test_source_file, '.c')
+ context.Result(result)
+ return result
</sconstruct>
<para>
@@ -380,30 +380,30 @@ conf = Configure(env, custom_tests = {'CheckMyLibrary' : CheckMyLibrary})
</para>
<sconstruct>
- mylib_test_source_file = """
- #include &amp;lt;mylib.h&amp;gt;
- int main(int argc, char **argv)
- {
- MyLibrary mylib(argc, argv);
- return 0;
- }
- """
-
- def CheckMyLibrary(context):
- context.Message('Checking for MyLibrary... ')
- result = context.TryLink(mylib_test_source_file, '.c')
- context.Result(result)
- return result
-
- env = Environment()
- conf = Configure(env, custom_tests = {'CheckMyLibrary' : CheckMyLibrary})
- if not conf.CheckMyLibrary():
- print 'MyLibrary is not installed!'
- Exit(1)
- env = conf.Finish()
+mylib_test_source_file = """
+#include &amp;lt;mylib.h&amp;gt;
+int main(int argc, char **argv)
+{
+ MyLibrary mylib(argc, argv);
+ return 0;
+}
+"""
+
+def CheckMyLibrary(context):
+ context.Message('Checking for MyLibrary... ')
+ result = context.TryLink(mylib_test_source_file, '.c')
+ context.Result(result)
+ return result
+
+env = Environment()
+conf = Configure(env, custom_tests = {'CheckMyLibrary' : CheckMyLibrary})
+if not conf.CheckMyLibrary():
+ print 'MyLibrary is not installed!'
+ Exit(1)
+env = conf.Finish()
- # We would then add actual calls like Program() to build
- # something using the "env" construction environment.
+# We would then add actual calls like Program() to build
+# something using the "env" construction environment.
</sconstruct>
<para>
diff --git a/doc/user/variants.xml b/doc/user/variants.xml
index f14cf6e0..74a155b0 100644
--- a/doc/user/variants.xml
+++ b/doc/user/variants.xml
@@ -84,53 +84,53 @@ is pretty smart about rebuilding things when you change options.
<scons_example name="variants_ex">
<file name="SConstruct" printme="1">
- platform = ARGUMENTS.get('OS', Platform())
+platform = ARGUMENTS.get('OS', Platform())
- include = "#export/$PLATFORM/include"
- lib = "#export/$PLATFORM/lib"
- bin = "#export/$PLATFORM/bin"
+include = "#export/$PLATFORM/include"
+lib = "#export/$PLATFORM/lib"
+bin = "#export/$PLATFORM/bin"
- env = Environment(PLATFORM = platform,
- BINDIR = bin,
- INCDIR = include,
- LIBDIR = lib,
- CPPPATH = [include],
- LIBPATH = [lib],
- LIBS = 'world')
+env = Environment(PLATFORM = platform,
+ BINDIR = bin,
+ INCDIR = include,
+ LIBDIR = lib,
+ CPPPATH = [include],
+ LIBPATH = [lib],
+ LIBS = 'world')
- Export('env')
+Export('env')
- env.SConscript('src/SConscript', variant_dir='build/$PLATFORM')
+env.SConscript('src/SConscript', variant_dir='build/$PLATFORM')
</file>
<directory name="src"></directory>
<directory name="src/hello"></directory>
<directory name="src/world"></directory>
<file name="src/SConscript">
- Import('env')
- SConscript('hello/SConscript')
- SConscript('world/SConscript')
+Import('env')
+SConscript('hello/SConscript')
+SConscript('world/SConscript')
</file>
<file name="src/hello/SConscript">
- Import('env')
- hello = env.Program('hello.c')
- env.Install('$BINDIR', hello)
+Import('env')
+hello = env.Program('hello.c')
+env.Install('$BINDIR', hello)
</file>
<file name="src/hello/hello.c">
- #include "world.h"
- int main(int argc, char *argv[]) { printf "hello.c\n"; world(); }
+#include "world.h"
+int main(int argc, char *argv[]) { printf "hello.c\n"; world(); }
</file>
<file name="src/world/SConscript">
- Import('env')
- world = env.Library('world.c')
- env.Install('$LIBDIR', world)
- env.Install('$INCDIR', 'world.h')
+Import('env')
+world = env.Library('world.c')
+env.Install('$LIBDIR', world)
+env.Install('$INCDIR', 'world.h')
</file>
<file name="src/world/world.h">
- #define STRING "world.h"
- extern int world();
+#define STRING "world.h"
+extern int world();
</file>
<file name="src/world/world.c">
- int world() { printf "world.c\n"; }
+int world() { printf "world.c\n"; }
</file>
</scons_example>