Fix adding a prefix when the target isn't specified.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 25 Jan 2003 06:37:58 +0000 (06:37 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 25 Jan 2003 06:37:58 +0000 (06:37 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@564 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Builder.py
src/engine/SCons/BuilderTests.py

index 391ddf8836d5a178ea9b0501f76cce9b69095c57..8f3d990a74d73dd09a6e51aebabbca3f747f1d4d 100644 (file)
@@ -39,6 +39,9 @@ RELEASE 0.11 - XXX
     the previous Builder attributes from the construction Environment.
     (Bug reported by Bj=F6rn Bylander.)
 
+  - Fix adding a prefix to a file when the target isn't specified.
+    (Bug reported by Esa Ilari Vuokko.)
+
   From Anthony Roach:
 
   - Use a different static object suffix (.os) when using gcc so shared
index 8de58c826f98cf54aef8d67c2bcaf30ad14107d5..ed2b767a5a3275126413ab6ddcf6c7643cf53505 100644 (file)
@@ -289,7 +289,7 @@ class BuilderBase:
             s = source[0]
             if isinstance(s, SCons.Node.Node):
                 s = os.path.split(str(s))[1]
-            target = [ os.path.splitext(s)[0] + suf ]
+            target = [ pre + os.path.splitext(s)[0] + suf ]
         else:
             target = adjustixes(target, pre, suf)
 
index 11674d649c5c77b30497fd79aa6dcb8109cdd401..8b9bd943903025019a858ec08a8935a18e31e7c7 100644 (file)
@@ -323,6 +323,9 @@ class BuilderTestCase(unittest.TestCase):
         tgt = builder(env, target = 'tgt2a tgt2b', source = 'src2')
         assert tgt.path == 'libtgt2a tgt2b', \
                 "Target has unexpected name: %s" % tgt.path
+        tgt = builder(env, source = 'src3')
+        assert tgt.path == 'libsrc3', \
+                "Target has unexpected name: %s" % tgt.path
 
     def test_src_suffix(self):
         """Test Builder creation with a specified source file suffix
@@ -377,6 +380,9 @@ class BuilderTestCase(unittest.TestCase):
         tgt = builder(env, target = 'tgt4a tgt4b', source = 'src4')
         assert tgt.path == 'tgt4a tgt4b.o', \
                 "Target has unexpected name: %s" % tgt.path
+        tgt = builder(env, source = 'src5')
+        assert tgt.path == 'src5.o', \
+                "Target has unexpected name: %s" % tgt.path
 
     def test_ListBuilder(self):
         """Testing ListBuilder class."""