diff options
Diffstat (limited to 'doc/user/output.xml')
-rw-r--r-- | doc/user/output.xml | 202 |
1 files changed, 101 insertions, 101 deletions
diff --git a/doc/user/output.xml b/doc/user/output.xml index d601e72..069d525 100644 --- a/doc/user/output.xml +++ b/doc/user/output.xml @@ -74,10 +74,10 @@ <scons_example name="output_ex1"> <file name="SConstruct" printme="1"> - Help(""" - Type: 'scons program' to build the production program, - 'scons debug' to build the debug version. - """) +Help(""" +Type: 'scons program' to build the production program, + 'scons debug' to build the debug version. +""") </file> </scons_example> @@ -132,12 +132,12 @@ <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> @@ -214,12 +214,12 @@ <scons_example name="output_COMSTR"> <file name="SConstruct" printme="1"> - env = Environment(CCCOMSTR = "Compiling $TARGET", - LINKCOMSTR = "Linking $TARGET") - env.Program('foo.c') +env = Environment(CCCOMSTR = "Compiling $TARGET", + LINKCOMSTR = "Linking $TARGET") +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> </scons_example> @@ -238,9 +238,9 @@ --> <screen> - % <userinput>scons -Q</userinput> - Compiling foo.o - Linking foo +% <userinput>scons -Q</userinput> +Compiling foo.o +Linking foo </screen> <para> @@ -286,14 +286,14 @@ <scons_example name="output_COMSTR-VERBOSE"> <file name="SConstruct" printme="1"> - env = Environment() - if ARGUMENTS.get('VERBOSE') != "1': - env['CCCOMSTR'] = "Compiling $TARGET" - env['LINKCOMSTR'] = "Linking $TARGET" - env.Program('foo.c') +env = Environment() +if ARGUMENTS.get('VERBOSE') != "1': + env['CCCOMSTR'] = "Compiling $TARGET" + env['LINKCOMSTR'] = "Linking $TARGET" +env.Program('foo.c') </file> <file name="foo.c"> - foo.c +foo.c </file> </scons_example> @@ -322,15 +322,15 @@ --> <screen> - % <userinput>scons -Q</userinput> - Compiling foo.o - Linking foo - % <userinput>scons -Q -c</userinput> - Removed foo.o - Removed foo - % <userinput>scons -Q VERBOSE=1</userinput> - cc -o foo.o -c foo.c - cc -o foo foo.o +% <userinput>scons -Q</userinput> +Compiling foo.o +Linking foo +% <userinput>scons -Q -c</userinput> +Removed foo.o +Removed foo +% <userinput>scons -Q VERBOSE=1</userinput> +cc -o foo.o -c foo.c +cc -o foo foo.o </screen> </section> @@ -372,15 +372,15 @@ <scons_example name="output_Progress-TARGET"> <file name="SConstruct" printme="1"> - Progress('Evaluating $TARGET\n') - Program('f1.c') - Program('f2.c') +Progress('Evaluating $TARGET\n') +Program('f1.c') +Program('f2.c') </file> <file name="f1.c"> - f1.c +f1.c </file> <file name="f2.c"> - f2.c +f2.c </file> </scons_example> @@ -425,11 +425,11 @@ </para> <sconstruct> - Progress('$TARGET\r', - file=open('/dev/tty', 'w'), - overwrite=True) - Program('f1.c') - Program('f2.c') +Progress('$TARGET\r', + file=open('/dev/tty', 'w'), + overwrite=True) +Program('f1.c') +Program('f2.c') </sconstruct> <para> @@ -482,9 +482,9 @@ </para> <sconstruct> - Progress(['-\r', '\\\r', '|\r', '/\r'], interval=5) - Program('f1.c') - Program('f2.c') +Progress(['-\r', '\\\r', '|\r', '/\r'], interval=5) +Program('f1.c') +Program('f2.c') </sconstruct> <para> @@ -522,13 +522,13 @@ <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 @@ <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 @@ <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> |