From: stevenknight Date: Sun, 23 Mar 2003 05:45:01 +0000 (+0000) Subject: Fix -U when no Default() targets are specified. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=b1056a0756400ccce5d20c351f1877eee8fdd225;p=scons.git Fix -U when no Default() targets are specified. git-svn-id: http://scons.tigris.org/svn/scons/trunk@620 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 83d65445..017c872f 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 760f2076..60d299d2 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 8abe7b98..f5a7b748 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') """)