summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2002-11-22 22:38:22 (GMT)
committerSteven Knight <knight@baldmt.com>2002-11-22 22:38:22 (GMT)
commitc7ac33dc426b2bab7636bbade3c6dbc726eb3a71 (patch)
tree40285c73822414ef23a23bb98a95756e2864cb5c
parent8afed5c0a1749053e08465a4c9cf8d05f8fe2340 (diff)
downloadSCons-c7ac33dc426b2bab7636bbade3c6dbc726eb3a71.zip
SCons-c7ac33dc426b2bab7636bbade3c6dbc726eb3a71.tar.gz
SCons-c7ac33dc426b2bab7636bbade3c6dbc726eb3a71.tar.bz2
Make Default(source) and -U fail gracefully. (Anthony Roach)
-rw-r--r--runtest.py25
-rw-r--r--src/CHANGES.txt2
-rw-r--r--src/engine/SCons/Script/__init__.py10
-rw-r--r--test/option--U.py6
4 files changed, 31 insertions, 12 deletions
diff --git a/runtest.py b/runtest.py
index ebaf758..6120aa5 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 957209f..4f071a2 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 bc6451c..3f3ff8d 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 23e82b1..4e8b408 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()