Make Default(source) and -U fail gracefully. (Anthony Roach)
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Fri, 22 Nov 2002 22:38:22 +0000 (22:38 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Fri, 22 Nov 2002 22:38:22 +0000 (22:38 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@500 fdb21ef1-2011-0410-befe-b5e4ea1792b1

runtest.py
src/CHANGES.txt
src/engine/SCons/Script/__init__.py
test/option--U.py

index ebaf7588c48d2de688581001fa9ad7efb5bd344c..6120aa508b7d8839624ab76dd2c236ec7b53a4ef 100644 (file)
@@ -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')
 
index 957209f13ca16d90e137cfabdd2cf7eec2766698..4f071a27c33e21954f64b2cef2b729310cc02cef 100644 (file)
@@ -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
index bc6451c0e08bfd15dcc9799a301198fd09ebcf75..3f3ff8d8b521b3a24aea0a1d293a5b700a2a9682 100644 (file)
@@ -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
index 23e82b18c30c2f78684fd92e94d7ba5401782d8b..4e8b408bd10a76c241aa1689c6818298fb7aa919 100644 (file)
@@ -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()