COMMAND_LINE_TARGETS = []
DEFAULT_TARGETS = []
+# BUILD_TARGETS can be modified in the SConscript files. If so, we
+# want to treat the modified BUILD_TARGETS list as if they specified
+# targets on the command line. To do that, though, we need to know if
+# BUILD_TARGETS was modified through "official" APIs or by hand. We do
+# this by updating two lists in parallel, the documented BUILD_TARGETS
+# list, above, and this internal _build_plus_default targets list which
+# should only have "official" API changes. Then Script/Main.py can
+# compare these two afterwards to figure out if the user added their
+# own targets to BUILD_TARGETS.
+_build_plus_default = TargetList()
+
def _Add_Arguments(alist):
for arg in alist:
a, b = string.split(arg, '=', 1)
BUILD_TARGETS.extend(tlist)
BUILD_TARGETS._add_Default = BUILD_TARGETS._do_nothing
BUILD_TARGETS._clear = BUILD_TARGETS._do_nothing
+ _build_plus_default.extend(tlist)
+ _build_plus_default._add_Default = _build_plus_default._do_nothing
+ _build_plus_default._clear = _build_plus_default._do_nothing
def _Set_Default_Targets_Has_Been_Called(d, fs):
return DEFAULT_TARGETS
# variables will still point to the same object we point to.
del DEFAULT_TARGETS[:]
BUILD_TARGETS._clear()
+ _build_plus_default._clear()
elif isinstance(t, SCons.Node.Node):
DEFAULT_TARGETS.append(t)
BUILD_TARGETS._add_Default([t])
+ _build_plus_default._add_Default([t])
else:
nodes = env.arg2nodes(t, env.fs.Entry)
DEFAULT_TARGETS.extend(nodes)
BUILD_TARGETS._add_Default(nodes)
+ _build_plus_default._add_Default(nodes)
#
help_text = None
test.write('SConscript', """assert GetLaunchDir() == r'%s'\n"""%test.workpath('sub1'))
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.must_exist(test.workpath('sub1', 'foo.out'))
+test.must_not_exist(test.workpath('sub2', 'bar.out'))
+test.must_not_exist(test.workpath('sub2b', 'bar.out'))
+test.must_not_exist(test.workpath('sub3', 'baz.out'))
+test.must_not_exist(test.workpath('bar.out'))
+test.must_not_exist(test.workpath('sub2/xxx.out'))
test.unlink(['sub1', 'foo.out'])
chdir = 'sub1',
stderr = "scons: *** No targets specified and no Default() targets found. Stop.\n",
status = 2)
-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.must_not_exist(test.workpath('sub1', 'foo.out'))
+test.must_not_exist(test.workpath('sub2', 'bar.out'))
+test.must_not_exist(test.workpath('sub2b', 'bar.out'))
+test.must_not_exist(test.workpath('sub3', 'baz.out'))
+test.must_not_exist(test.workpath('bar.out'))
+test.must_not_exist(test.workpath('sub2/xxx.out'))
if sys.platform == 'win32':
- test.write('SConscript', """assert GetLaunchDir() == r'%s'"""%test.workpath('SUB2'))
- test.run(chdir = 'SUB2', arguments = '-U')
+ sub2 = 'SUB2'
else:
- test.write('SConscript', """assert GetLaunchDir() == r'%s'"""%test.workpath('sub2'))
- 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')))
+ sub2 = 'sub2'
+test.write('SConscript', """assert GetLaunchDir() == r'%s'"""%test.workpath(sub2))
+test.run(chdir = sub2, arguments = '-U')
+test.must_not_exist(test.workpath('sub1', 'foo.out'))
+test.must_exist(test.workpath('sub2', 'bar.out'))
+test.must_exist(test.workpath('sub2b', 'bar.out'))
+test.must_not_exist(test.workpath('sub3', 'baz.out'))
+test.must_exist(test.workpath('bar.out'))
+test.must_not_exist(test.workpath('sub2/xxx.out'))
test.unlink(['sub2', 'bar.out'])
test.unlink(['sub2b', 'bar.out'])
test.write('SConscript', """assert GetLaunchDir() == r'%s'"""%test.workpath())
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.must_exist(test.workpath('sub1', 'foo.out'))
+test.must_not_exist(test.workpath('sub2', 'bar.out'))
+test.must_not_exist(test.workpath('sub2b', 'bar.out'))
+test.must_exist(test.workpath('sub3', 'baz.out'))
+test.must_not_exist(test.workpath('bar.out'))
+test.must_exist(test.workpath('sub2/xxx.out'))
test.unlink(['sub1', 'foo.out'])
test.unlink(['sub3', 'baz.out'])
test.write('SConscript', """assert GetLaunchDir() == r'%s'"""%test.workpath('sub3'))
test.run(chdir = 'sub3', arguments='-U bar')
-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(os.path.exists(test.workpath('bar.out')))
-test.fail_test(os.path.exists(test.workpath('sub2/xxx.out')))
+test.must_not_exist(test.workpath('sub1', 'foo.out'))
+test.must_exist(test.workpath('sub2', 'bar.out'))
+test.must_exist(test.workpath('sub2b', 'bar.out'))
+test.must_not_exist(test.workpath('sub3', 'baz.out'))
+test.must_not_exist(test.workpath('bar.out'))
+test.must_not_exist(test.workpath('sub2/xxx.out'))
# Make sure that a Default() directory doesn't cause an exception.
test.subdir('sub4')
test.run(chdir = 'sub6/dir', arguments = '-U ../foo.out')
-test.fail_test(not os.path.exists(test.workpath('sub6', 'foo.out')))
-test.fail_test(os.path.exists(test.workpath('sub6', 'dir', 'bar.out')))
+test.must_exist(test.workpath('sub6', 'foo.out'))
+test.must_not_exist(test.workpath('sub6', 'dir', 'bar.out'))
test.pass_test()