summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-03-23 05:45:01 (GMT)
committerSteven Knight <knight@baldmt.com>2003-03-23 05:45:01 (GMT)
commit8d8e5b7a7edcfb7ac3795977c33c7f6e561abdda (patch)
treeef97ab12a1213395403354c91f509dd9fb191fcf
parentbff7f4d25677f6d1543abe553e3b7a63dc910b0c (diff)
downloadSCons-8d8e5b7a7edcfb7ac3795977c33c7f6e561abdda.zip
SCons-8d8e5b7a7edcfb7ac3795977c33c7f6e561abdda.tar.gz
SCons-8d8e5b7a7edcfb7ac3795977c33c7f6e561abdda.tar.bz2
Fix -U when no Default() targets are specified.
-rw-r--r--src/CHANGES.txt3
-rw-r--r--src/engine/SCons/Script/__init__.py5
-rw-r--r--test/option--U.py17
3 files changed, 22 insertions, 3 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 83d6544..017c872 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -80,6 +80,9 @@ RELEASE 0.12 - XXX
- Change the default SConscriptChdir() behavior to change to the
SConscript directory while it's being read.
+ - Fix an exception thrown when the -U option was used with no
+ Default() target specified.
+
From Lachlan O'Dea:
- Add SharedObject() support to the masm tool.
diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py
index 760f207..60d299d 100644
--- a/src/engine/SCons/Script/__init__.py
+++ b/src/engine/SCons/Script/__init__.py
@@ -823,7 +823,10 @@ def _main():
# or not a file, so go ahead and keep it as a default
# target and let the engine sort it out:
return 1
- default_targets = filter(check_dir, default_targets)
+ if default_targets is None:
+ default_targets = []
+ else:
+ default_targets = filter(check_dir, default_targets)
SCons.Script.SConscript.default_targets = default_targets
target_top = None
diff --git a/test/option--U.py b/test/option--U.py
index 8abe7b9..f5a7b74 100644
--- a/test/option--U.py
+++ b/test/option--U.py
@@ -85,7 +85,10 @@ test.fail_test(os.path.exists(test.workpath('sub2/xxx.out')))
test.unlink(['sub1', 'foo.out'])
test.write('SConscript', """assert GetLaunchDir() == r'%s'"""%test.workpath('sub1'))
-test.run(arguments = '-U', chdir = 'sub1', stderr = None, status = 2)
+test.run(arguments = '-U',
+ 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')))
@@ -133,7 +136,6 @@ 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')))
-
# Make sure that a Default() directory doesn't cause an exception.
test.subdir('sub4')
@@ -143,6 +145,17 @@ Default('.')
test.run(chdir = 'sub4', arguments = '-U')
+# Make sure no Default() targets doesn't cause an exception.
+test.subdir('sub5')
+
+test.write(['sub5', 'SConstruct'], "\n")
+
+test.run(chdir = 'sub5',
+ arguments = '-U',
+ stderr = "scons: *** No targets specified and no Default() targets found. Stop.\n",
+ status = 2)
+
+#
test.write('SConstruct', """
Default('not_a_target.in')
""")