From 61f402b43484c252ee69c97ba532bc9f03bddb8f Mon Sep 17 00:00:00 2001 From: stevenknight Date: Fri, 22 Nov 2002 22:38:22 +0000 Subject: [PATCH] Make Default(source) and -U fail gracefully. (Anthony Roach) git-svn-id: http://scons.tigris.org/svn/scons/trunk@500 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- runtest.py | 25 +++++++++++++++---------- src/CHANGES.txt | 2 ++ src/engine/SCons/Script/__init__.py | 10 ++++++++-- test/option--U.py | 6 ++++++ 4 files changed, 31 insertions(+), 12 deletions(-) diff --git a/runtest.py b/runtest.py index ebaf7588..6120aa50 100644 --- a/runtest.py +++ b/runtest.py @@ -245,16 +245,21 @@ if package: else: sd = None ld = None - if spe: - if not scons: - for dir in spe: - d = os.path.join(dir, 'src', 'script') - f = os.path.join(d, 'scons.py') - if os.path.isfile(f): - sd = d - scons = f - spe = map(lambda x: os.path.join(x, 'src', 'engine'), spe) - ld = string.join(spe, os.pathsep) + + # XXX: Logic like the following will be necessary once + # we fix runtest.py to run tests within an Aegis change + # without symlinks back to the baseline(s). + # + #if spe: + # if not scons: + # for dir in spe: + # d = os.path.join(dir, 'src', 'script') + # f = os.path.join(d, 'scons.py') + # if os.path.isfile(f): + # sd = d + # scons = f + # spe = map(lambda x: os.path.join(x, 'src', 'engine'), spe) + # ld = string.join(spe, os.pathsep) scons_dir = sd or os.path.join(cwd, 'src', 'script') diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 957209f1..4f071a27 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -113,6 +113,8 @@ RELEASE 0.09 - - Add a SetContentSignatureType() function, allowing use of file timestamps instead of MD5 signatures. + - Make -U and Default('source') fail gracefully. + From sam th: - Dynamically check for the existence of utilities with which to diff --git a/src/engine/SCons/Script/__init__.py b/src/engine/SCons/Script/__init__.py index bc6451c0..3f3ff8d8 100644 --- a/src/engine/SCons/Script/__init__.py +++ b/src/engine/SCons/Script/__init__.py @@ -742,8 +742,14 @@ def _main(): # -U with default targets default_targets = SCons.Script.SConscript.default_targets def check_dir(x, target_top=target_top): - cwd = x.cwd.srcnode() - return cwd == target_top + if hasattr(x, 'cwd') and not x.cwd is None: + cwd = x.cwd.srcnode() + return cwd == target_top + else: + # x doesn't have a cwd, so it's either not a target, + # 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) SCons.Script.SConscript.default_targets = default_targets target_top = None diff --git a/test/option--U.py b/test/option--U.py index 23e82b18..4e8b408b 100644 --- a/test/option--U.py +++ b/test/option--U.py @@ -143,5 +143,11 @@ Default('.') test.run(chdir = 'sub4', arguments = '-U') +test.write('SConstruct', """ +Default('no_a_target.in') +""") + +# The following should result in an error, but because of bug 642327, it doesn't: +test.run(arguments = '-U') test.pass_test() -- 2.26.2