Make sure auto-deducing target names works when a Node is passed in as a source file.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 28 Aug 2002 14:28:02 +0000 (14:28 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Wed, 28 Aug 2002 14:28:02 +0000 (14:28 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@449 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/engine/SCons/Builder.py
src/engine/SCons/BuilderTests.py
test/no-target.py

index 9edd12187d3eeed1abf4b7b316eb1dc7e58ae073..fe6283b7c5cf4e31556243da4dea3616e4824722 100644 (file)
@@ -286,7 +286,8 @@ class BuilderBase:
 
         source = adjustixes(source, None, src_suf)
         if target is None:
-            target = map(lambda x, s=suf: os.path.splitext(x)[0] + s,
+            target = map(lambda x, s=suf:
+                                os.path.splitext(os.path.split(str(x))[1])[0] + s,
                          source)
         else:
             target = adjustixes(target, pre, suf)
index 8451d995f644903f99bb974563ab447560bf5b43..e862b0567b40076768972738c10bbc92b6aadca5 100644 (file)
@@ -833,6 +833,19 @@ class BuilderTestCase(unittest.TestCase):
         assert str(tgt[1].sources[0]) == 'h0.c', map(str, tgt[1].sources)
         assert str(tgt[1].sources[1]) == 'h1.c', map(str, tgt[1].sources)
 
+        w = b(env, target='i0.w', source=['i0.x'])
+        y = b(env, target='i1.y', source=['i1.z'])
+        tgt = b(env, source=[w, y])
+        assert len(tgt) == 2, map(str, tgt)
+        assert str(tgt[0]) == 'i0.o'
+        assert str(tgt[1]) == 'i1.o'
+        assert len(tgt[0].sources) == 2, map(str, tgt[0].sources)
+        assert str(tgt[0].sources[0]) == 'i0.w', map(str, tgt[0].sources)
+        assert str(tgt[0].sources[1]) == 'i1.y', map(str, tgt[0].sources)
+        assert len(tgt[1].sources) == 2, map(str, tgt[1].sources)
+        assert str(tgt[1].sources[0]) == 'i0.w', map(str, tgt[1].sources)
+        assert str(tgt[1].sources[1]) == 'i1.y', map(str, tgt[1].sources)
+
 
 if __name__ == "__main__":
     suite = unittest.makeSuite(BuilderTestCase, 'test_')
index 7aa56c4ea7a74cca90f0b4f18c7af9379e88bf5b..dd24a8d70addf443b99b9d387dfb1e33955976e5 100644 (file)
@@ -51,14 +51,18 @@ def cat(env, source, target):
 b = Builder(action=cat, suffix='.out', src_suffix='.in')
 env = Environment(BUILDERS={'Build':b})
 env.Build('aaa.in')
+n = env.Build('bbb.in', 'bbb.input')
+env.Build(n)
 """)
 
 test.write(['subdir', 'aaa.in'], "subdir/aaa.in\n")
+test.write(['subdir', 'bbb.input'], "subdir/bbb.input\n")
 
 #
 test.run(arguments = '.')
 
 test.fail_test(test.read(['subdir', 'aaa.out']) != "subdir/aaa.in\n")
+test.fail_test(test.read(['subdir', 'bbb.out']) != "subdir/bbb.input\n")
 
 #
 test.pass_test()