From a177bfae9c77a166aba93a8c0c4ab4cfc9012e71 Mon Sep 17 00:00:00 2001 From: Dirk Baechle Date: Sun, 6 Oct 2013 18:48:36 +0200 Subject: - additional corrections for left alignment --- doc/generated/variables.gen | 2 + doc/user/add-method.xml | 36 ++++++------ doc/user/builders-writing.xml | 44 +++++++-------- doc/user/caching.xml | 22 ++++---- doc/user/command-line.xml | 44 +++++++-------- doc/user/depends.xml | 96 ++++++++++++++++---------------- doc/user/environments.xml | 96 +++++++++++++++----------------- doc/user/less-simple.xml | 14 ++--- doc/user/misc.xml | 36 ++++++------ doc/user/nodes.xml | 8 +-- doc/user/output.xml | 124 +++++++++++++++++++++--------------------- doc/user/scanners.xml | 28 +++++----- doc/user/sconf.xml | 74 ++++++++++++------------- doc/user/variants.xml | 56 +++++++++---------- src/engine/SCons/Tool/zip.xml | 2 + 15 files changed, 339 insertions(+), 343 deletions(-) diff --git a/doc/generated/variables.gen b/doc/generated/variables.gen index b213916..784cd28 100644 --- a/doc/generated/variables.gen +++ b/doc/generated/variables.gen @@ -7355,11 +7355,13 @@ General options passed to the zip utility. ZIPROOT + An optional zip root directory (default empty). The filenames stored in the zip file will be relative to this directory, if given. Otherwise the filenames are relative to the current directory of the command. For instance: + env = Environment() env.Zip('foo.zip', 'subdir1/subdir2/file1', ZIPROOT='subdir1') diff --git a/doc/user/add-method.xml b/doc/user/add-method.xml index e94626b..c50786c 100644 --- a/doc/user/add-method.xml +++ b/doc/user/add-method.xml @@ -100,28 +100,28 @@ int main() { printf("Hello, world!\n"); } - 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') - int main() { printf("Hello, world!\n"); } +int main() { printf("Hello, world!\n"); } - res.rc +res.rc diff --git a/doc/user/builders-writing.xml b/doc/user/builders-writing.xml index 383823a..e6e2aaf 100644 --- a/doc/user/builders-writing.xml +++ b/doc/user/builders-writing.xml @@ -812,38 +812,38 @@ env.Foo('file') - bld = Builder(action = 'my_command $SOURCES > $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 > $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() - file1.input +file1.input - file2.input +file2.input - modify1.input +modify1.input - modify2.input +modify2.input - cat +cat diff --git a/doc/user/caching.xml b/doc/user/caching.xml index f728653..9c66c31 100644 --- a/doc/user/caching.xml +++ b/doc/user/caching.xml @@ -424,20 +424,20 @@ Program('prog', scons -Q - -random - 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. - --> +--> - % scons -Q --random - 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 + % scons -Q --random + 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 diff --git a/doc/user/command-line.xml b/doc/user/command-line.xml index d2e4146..f410b3e 100644 --- a/doc/user/command-line.xml +++ b/doc/user/command-line.xml @@ -628,21 +628,21 @@ foo.in - 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) - foo.in +foo.in @@ -1092,21 +1092,21 @@ RELEASE = 1 - 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)) - foo.c +foo.c - bar.c +bar.c - RELEASE = 0 +RELEASE = 0 diff --git a/doc/user/depends.xml b/doc/user/depends.xml index 2dd7ea6..3882af7 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 - #define FOO_HEADER <foo.h> - #include FOO_HEADER +#define FOO_HEADER <foo.h> +#include FOO_HEADER - int main() { - return FOO; - } +int main() { + return FOO; +} - Program('hello', 'hello.c', CPPPATH='.') +Program('hello', 'hello.c', CPPPATH='.') - #define FOO 42 +#define FOO 42 @@ -1416,24 +1416,24 @@ cc -o hello hello.o - #define FOO_HEADER <foo.h> - #include FOO_HEADER +#define FOO_HEADER <foo.h> +#include FOO_HEADER - int main() { - return FOO; - } +int main() { + return FOO; +} - 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) - #define FOO 42 +#define FOO 42 - hello.o: hello.c foo.h +hello.o: hello.c foo.h @@ -1453,21 +1453,21 @@ cc -o hello hello.o - #define FOO_HEADER <foo.h> - #include FOO_HEADER +#define FOO_HEADER <foo.h> +#include FOO_HEADER - int main() { - return FOO; - } +int main() { + return FOO; +} - 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) - #define FOO 42 +#define FOO 42 @@ -1669,18 +1669,18 @@ int main() { printf("Hello!\n"); } - 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']) - 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); } @@ -1728,23 +1728,23 @@ int main() { printf("Hello!\n"); } - 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) - 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); } diff --git a/doc/user/environments.xml b/doc/user/environments.xml index f11a95b..b9585cb 100644 --- a/doc/user/environments.xml +++ b/doc/user/environments.xml @@ -579,13 +579,13 @@ env = Environment() - env = Environment(CC = 'gcc', - CCFLAGS = '-O2') + env = Environment(CC = 'gcc', + CCFLAGS = '-O2') - env.Program('foo.c') + env.Program('foo.c') - int main() { } +int main() { } @@ -861,8 +861,6 @@ print "value is:", env.subst( '->${1 / 0}<-' ) scons -Q - - If &AllowSubstExceptions; is called multiple times, each call @@ -903,9 +901,7 @@ print "value is:", env.subst( '->${1 / 0}<-' ) - - DefaultEnvironment(CC = '/usr/local/bin/gcc') - +DefaultEnvironment(CC = '/usr/local/bin/gcc') @@ -937,10 +933,8 @@ print "value is:", env.subst( '->${1 / 0}<-' ) - - env = DefaultEnvironment() - env['CC'] = '/usr/local/bin/gcc' - +env = DefaultEnvironment() +env['CC'] = '/usr/local/bin/gcc' @@ -966,10 +960,8 @@ print "value is:", env.subst( '->${1 / 0}<-' ) - - env = DefaultEnvironment(tools = ['gcc', 'gnulink'], - CC = '/usr/local/bin/gcc') - +env = DefaultEnvironment(tools = ['gcc', 'gnulink'], + CC = '/usr/local/bin/gcc') @@ -1005,18 +997,18 @@ print "value is:", env.subst( '->${1 / 0}<-' ) - 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') - int main() { } +int main() { } - int main() { } +int main() { } @@ -1036,15 +1028,15 @@ print "value is:", env.subst( '->${1 / 0}<-' ) - 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') - int main() { } +int main() { } @@ -1081,17 +1073,17 @@ print "value is:", env.subst( '->${1 / 0}<-' ) - 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) - int main() { } +int main() { } @@ -1149,20 +1141,20 @@ print "value is:", env.subst( '->${1 / 0}<-' ) - 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) - int main() { } +int main() { } @@ -1258,19 +1250,19 @@ print "NEW_VARIABLE =", env['NEW_VARIABLE'] - 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') - int main() { } +int main() { } - int main() { } +int main() { } diff --git a/doc/user/less-simple.xml b/doc/user/less-simple.xml index 4c60cc7..41a1f3d 100644 --- a/doc/user/less-simple.xml +++ b/doc/user/less-simple.xml @@ -337,15 +337,15 @@ Program('program2', ['program2.c']) - 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']) diff --git a/doc/user/misc.xml b/doc/user/misc.xml index 4145d49..d0aeb59 100644 --- a/doc/user/misc.xml +++ b/doc/user/misc.xml @@ -501,20 +501,20 @@ prog2.c - 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 - prog1.c +prog1.c - prog2.c +prog2.c @@ -542,20 +542,20 @@ prog2.c - 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 - prog1.c +prog1.c - prog2.c +prog2.c diff --git a/doc/user/nodes.xml b/doc/user/nodes.xml index 78f15e3..1c9b4fd 100644 --- a/doc/user/nodes.xml +++ b/doc/user/nodes.xml @@ -183,11 +183,11 @@ int main() { printf("Goodbye, world!\n"); } - 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') diff --git a/doc/user/output.xml b/doc/user/output.xml index de6b8d4..069d525 100644 --- a/doc/user/output.xml +++ b/doc/user/output.xml @@ -132,12 +132,12 @@ Type: 'scons program' to build the production program, - 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") @@ -522,13 +522,13 @@ Program('f2.c') - 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) @@ -595,13 +595,13 @@ Program('f2.c') - 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) @@ -639,52 +639,52 @@ Program('f2.c') - # 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) diff --git a/doc/user/scanners.xml b/doc/user/scanners.xml index 5ed0d62..758a849 100644 --- a/doc/user/scanners.xml +++ b/doc/user/scanners.xml @@ -308,34 +308,34 @@ env.Append(SCANNERS = kscan) - 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 < $SOURCES > $TARGET') + env.Command('foo', 'foo.k', 'kprocess < $SOURCES > $TARGET') - include other_file +include other_file - other_file +other_file - cat +cat diff --git a/doc/user/sconf.xml b/doc/user/sconf.xml index e787db9..31bd45e 100644 --- a/doc/user/sconf.xml +++ b/doc/user/sconf.xml @@ -303,20 +303,20 @@ env = conf.Finish() - mylib_test_source_file = """ - #include &lt;mylib.h&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 &lt;mylib.h&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 @@ -380,30 +380,30 @@ conf = Configure(env, custom_tests = {'CheckMyLibrary' : CheckMyLibrary}) - mylib_test_source_file = """ - #include &lt;mylib.h&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 &lt;mylib.h&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. diff --git a/doc/user/variants.xml b/doc/user/variants.xml index f14cf6e..74a155b 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. - 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') - Import('env') - SConscript('hello/SConscript') - SConscript('world/SConscript') +Import('env') +SConscript('hello/SConscript') +SConscript('world/SConscript') - Import('env') - hello = env.Program('hello.c') - env.Install('$BINDIR', hello) +Import('env') +hello = env.Program('hello.c') +env.Install('$BINDIR', hello) - #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(); } - 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') - #define STRING "world.h" - extern int world(); +#define STRING "world.h" +extern int world(); - int world() { printf "world.c\n"; } +int world() { printf "world.c\n"; } diff --git a/src/engine/SCons/Tool/zip.xml b/src/engine/SCons/Tool/zip.xml index af68533..f43aa31 100644 --- a/src/engine/SCons/Tool/zip.xml +++ b/src/engine/SCons/Tool/zip.xml @@ -145,11 +145,13 @@ The suffix used for zip file names. + An optional zip root directory (default empty). The filenames stored in the zip file will be relative to this directory, if given. Otherwise the filenames are relative to the current directory of the command. For instance: + env = Environment() env.Zip('foo.zip', 'subdir1/subdir2/file1', ZIPROOT='subdir1') -- cgit v0.12