.\" figuring out why a specific file is being rebuilt, as well as
.\" general debugging of the build process.
+.TP
+-D
+Works exactly the same way as the
+.B -u
+option except for the way default targets are handled.
+When this option is used and no targets are specified on the command line,
+all default targets are built, whether or not they are below the current
+directory.
+
.TP
.RI --debug= type
Debug the build process.
appear up-to-date is unnecessary when using
.BR scons .)
+.TP
+-T
+Works exactly the same way as the
+.B -u
+option except for the way default targets are handled.
+When this option is used and no targets are specified on the command line,
+all default targets that are defined in the SConscript files in the current
+directory are built, regardless of what directory the resulant targets end
+up in.
+
.TP
-u, --up, --search-up
Walks up the directory structure until an
.B -u
option except for the way default targets are handled.
When this option is used and no targets are specified on the command line,
-all default targets are built, whether or not they are below the current
-directory.
+all default targets that are defined in the SConscript(s) in the current
+directory are built, regardless of what directory the resulant targets end
+up in.
.TP
-v, --version
- Write out .sconsign files on error or interrupt so intermediate
build results are saved.
+ - Change the -U option to -D. Make a new -U that builds just the
+ targets from the local SConscript file.
+
RELEASE 0.06 - Thu, 28 Mar 2002 01:24:29 -0600
This is the seventh alpha release of SCons. Please consult the
CHANGES.txt file for a list of specific changes since last release.
- Please note the following important changes since the previous
- release:
+ Please note the following important changes since release 0.06:
+
+ - The functionality of the -U option has changed. XXX
+
+ Please note the following important changes since release 0.05:
- Scanner functions now take four arguments.
short = 'd',
help = "Print file dependency information.")
+ def opt_D(opt, arg):
+ global climb_up
+ climb_up = 2
+
+ Option(func = opt_D,
+ short = 'D',
+ help = "Search up directory tree for SConstruct.")
+
def opt_debug(opt, arg):
global print_tree
global print_dtree
def opt_U(opt, arg):
global climb_up
- climb_up = 2
+ climb_up = 3
Option(func = opt_U,
- short = 'U',
- help = "Search up directory tree for SConstruct.")
+ short = 'U',
+ help = "Search up directory tree for SConstruct.")
def option_v(opt, arg):
import SCons
SCons.Script.SConscript._scons_add_args(xmit_args)
if climb_up:
- target_top = '' # directory to prepend to targets
+ target_top = '.' # directory to prepend to targets
script_dir = os.getcwd() # location of script
while script_dir and not _SConstruct_exists(script_dir):
script_dir, last_part = os.path.split(script_dir)
sys.exit(0)
if target_top:
+ target_top = SCons.Node.FS.default_fs.Dir(target_top)
+
if climb_up == 2 and not targets:
+ # -D with default targets
+ target_top = None
+ elif climb_up == 3 and not targets:
# -U with default targets
+ default_targets = SCons.Script.SConscript.default_targets
+ default_targets = filter(lambda x: x.cwd.srcpath == str(target_top),
+ default_targets)
+ SCons.Script.SConscript.default_targets = default_targets
target_top = None
- else:
- target_top = SCons.Node.FS.default_fs.Dir(target_top)
if not targets:
targets = SCons.Script.SConscript.default_targets
--- /dev/null
+#!/usr/bin/env python
+#
+# Copyright (c) 2001, 2002 Steven Knight
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import sys
+import TestSCons
+
+python = sys.executable
+
+test = TestSCons.TestSCons()
+
+test.subdir('sub1', 'sub2')
+
+test.write('build.py', r"""
+import sys
+contents = open(sys.argv[2], 'rb').read()
+file = open(sys.argv[1], 'wb')
+file.write(contents)
+file.close()
+""")
+
+test.write('SConstruct', """
+B = Builder(name='B', action='%s build.py $TARGET $SOURCES')
+env = Environment(BUILDERS = [B])
+env.B(target = 'sub1/foo.out', source = 'sub1/foo.in')
+Export('env')
+SConscript('sub1/SConscript')
+SConscript('sub2/SConscript')
+""" % python)
+
+test.write(['sub1', 'SConscript'], """
+Import('env')
+env.B(target = 'foo.out', source = 'foo.in')
+Default('.')
+""")
+
+test.write(['sub1', 'foo.in'], "sub1/foo.in")
+
+test.write(['sub2', 'SConscript'], """
+Import('env')
+env.B(target = 'bar.out', source = 'bar.in')
+Default('.')
+""")
+
+test.write(['sub2', 'bar.in'], "sub2/bar.in")
+
+test.run(arguments = '-D', chdir = 'sub1')
+
+test.fail_test(test.read(['sub1', 'foo.out']) != "sub1/foo.in")
+test.fail_test(test.read(['sub2', 'bar.out']) != "sub2/bar.in")
+
+test.pass_test()
+
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import os.path
import sys
-import TestSCons
-python = sys.executable
+import TestSCons
test = TestSCons.TestSCons()
-test.subdir('sub1', 'sub2')
+python = sys.executable
+
+test.subdir('sub1', 'sub2', 'sub3')
test.write('build.py', r"""
import sys
test.write('SConstruct', """
B = Builder(name='B', action='%s build.py $TARGET $SOURCES')
env = Environment(BUILDERS = [B])
-env.B(target = 'sub1/foo.out', source = 'sub1/foo.in')
+Default(env.B(target = 'sub1/foo.out', source = 'sub1/foo.in'))
Export('env')
-SConscript('sub1/SConscript')
SConscript('sub2/SConscript')
+Default(env.B(target = 'sub3/baz.out', source = 'sub3/baz.in'))
+BuildDir('sub2b', 'sub2')
+SConscript('sub2b/SConscript')
+Default(env.B(target = 'sub2/xxx.out', source = 'xxx.in'))
""" % python)
-test.write(['sub1', 'SConscript'], """
+test.write(['sub2', 'SConscript'], """
Import('env')
-env.B(target = 'foo.out', source = 'foo.in')
-Default('.')
+Default(env.B(target = 'bar.out', source = 'bar.in'))
+Default(env.B(target = '../bar.out', source = 'bar.in'))
""")
-test.write(['sub1', 'foo.in'], "sub1/foo.in")
-test.write(['sub2', 'SConscript'], """
-Import('env')
-env.B(target = 'bar.out', source = 'bar.in')
-Default('.')
-""")
+test.write(['sub1', 'foo.in'], "sub1/foo.in\n")
+test.write(['sub2', 'bar.in'], "sub2/bar.in\n")
+test.write(['sub3', 'baz.in'], "sub3/baz.in\n")
+test.write('xxx.in', "xxx.in\n")
+
+test.run(arguments = '-U foo.out', chdir = 'sub1')
+
+test.fail_test(not os.path.exists(test.workpath('sub1', 'foo.out')))
+test.fail_test(os.path.exists(test.workpath('sub2', 'bar.out')))
+test.fail_test(os.path.exists(test.workpath('sub2b', 'bar.out')))
+test.fail_test(os.path.exists(test.workpath('sub3', 'baz.out')))
+test.fail_test(os.path.exists(test.workpath('bar.out')))
+test.fail_test(os.path.exists(test.workpath('sub2/xxx.out')))
-test.write(['sub2', 'bar.in'], "sub2/bar.in")
+test.unlink(['sub1', 'foo.out'])
test.run(arguments = '-U', chdir = 'sub1')
+test.fail_test(os.path.exists(test.workpath('sub1', 'foo.out')))
+test.fail_test(os.path.exists(test.workpath('sub2', 'bar.out')))
+test.fail_test(os.path.exists(test.workpath('sub2b', 'bar.out')))
+test.fail_test(os.path.exists(test.workpath('sub3', 'baz.out')))
+test.fail_test(os.path.exists(test.workpath('bar.out')))
+test.fail_test(os.path.exists(test.workpath('sub2/xxx.out')))
+
+test.run(chdir = 'sub2', arguments = '-U')
+test.fail_test(os.path.exists(test.workpath('sub1', 'foo.out')))
+test.fail_test(not os.path.exists(test.workpath('sub2', 'bar.out')))
+test.fail_test(not os.path.exists(test.workpath('sub2b', 'bar.out')))
+test.fail_test(os.path.exists(test.workpath('sub3', 'baz.out')))
+test.fail_test(not os.path.exists(test.workpath('bar.out')))
+test.fail_test(os.path.exists(test.workpath('sub2/xxx.out')))
+
+test.unlink(['sub2', 'bar.out'])
+test.unlink(['sub2b', 'bar.out'])
+test.unlink('bar.out')
+
+test.run(arguments='-U')
+test.fail_test(not os.path.exists(test.workpath('sub1', 'foo.out')))
+test.fail_test(os.path.exists(test.workpath('sub2', 'bar.out')))
+test.fail_test(os.path.exists(test.workpath('sub2b', 'bar.out')))
+test.fail_test(not os.path.exists(test.workpath('sub3', 'baz.out')))
+test.fail_test(os.path.exists(test.workpath('bar.out')))
+test.fail_test(not os.path.exists(test.workpath('sub2/xxx.out')))
-test.fail_test(test.read(['sub1', 'foo.out']) != "sub1/foo.in")
-test.fail_test(test.read(['sub2', 'bar.out']) != "sub2/bar.in")
test.pass_test()