summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-01-07 23:12:02 (GMT)
committerSteven Knight <knight@baldmt.com>2003-01-07 23:12:02 (GMT)
commit61a74e9d5770e83b296356700c128bd3dd59601e (patch)
treeee0ef019043714839245ab5e41ff4aaee45311c2 /src
parentcbb5c537f33929ddf7795d627ccae0f42b5b361f (diff)
downloadSCons-61a74e9d5770e83b296356700c128bd3dd59601e.zip
SCons-61a74e9d5770e83b296356700c128bd3dd59601e.tar.gz
SCons-61a74e9d5770e83b296356700c128bd3dd59601e.tar.bz2
Fix files with the same name as subdirs.
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt7
-rw-r--r--src/engine/SCons/Builder.py7
-rw-r--r--src/engine/SCons/BuilderTests.py39
3 files changed, 23 insertions, 30 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index c297718..c861078 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -37,6 +37,13 @@ RELEASE 0.10 - XXX
- Fix specifying only the source file to MultiStepBuilders such as
the Program Builder. (Bug reported by Dean Bair.)
+ - Fix an exception when building from a file with the same basename as
+ the subdirectory in which it lives. (Bug reported by Gerard Patel.)
+
+ - Fix automatic deduction of a target file name when there are
+ multiple source files specified; the target is now deduced from just
+ the first source file in the list.
+
From Steve Leblanc:
- Add a Clean() method to support removing user-specified targets
diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py
index 2c45855..9c91c01 100644
--- a/src/engine/SCons/Builder.py
+++ b/src/engine/SCons/Builder.py
@@ -285,9 +285,10 @@ class BuilderBase:
source = adjustixes(source, None, src_suf)
if target is None:
- target = map(lambda x, s=suf:
- os.path.splitext(os.path.split(str(x))[1])[0] + s,
- source)
+ s = source[0]
+ if isinstance(s, SCons.Node.Node):
+ s = os.path.split(str(s))[1]
+ target = [ os.path.splitext(s)[0] + suf ]
else:
target = adjustixes(target, pre, suf)
diff --git a/src/engine/SCons/BuilderTests.py b/src/engine/SCons/BuilderTests.py
index 57069df..5c0f0d6 100644
--- a/src/engine/SCons/BuilderTests.py
+++ b/src/engine/SCons/BuilderTests.py
@@ -641,15 +641,10 @@ class BuilderTestCase(unittest.TestCase):
assert str(tgt.sources[0]) == 'ccc.x.c', map(str, tgt.sources)
tgt = b(env, ['d0.c', 'd1.c'])
- assert len(tgt) == 2, map(str, tgt)
- assert str(tgt[0]) == 'd0.o', map(str, tgt)
- assert str(tgt[1]) == 'd1.o', map(str, tgt)
- assert len(tgt[0].sources) == 2, map(str, tgt[0].sources)
- assert str(tgt[0].sources[0]) == 'd0.c', map(str, tgt[0].sources)
- assert str(tgt[0].sources[1]) == 'd1.c', map(str, tgt[0].sources)
- assert len(tgt[1].sources) == 2, map(str, tgt[1].sources)
- assert str(tgt[1].sources[0]) == 'd0.c', map(str, tgt[1].sources)
- assert str(tgt[1].sources[1]) == 'd1.c', map(str, tgt[1].sources)
+ assert str(tgt) == 'd0.o', str(tgt)
+ assert len(tgt.sources) == 2, map(str, tgt.sources)
+ assert str(tgt.sources[0]) == 'd0.c', map(str, tgt.sources)
+ assert str(tgt.sources[1]) == 'd1.c', map(str, tgt.sources)
tgt = b(env, source='eee')
assert str(tgt) == 'eee.o', str(tgt)
@@ -667,28 +662,18 @@ class BuilderTestCase(unittest.TestCase):
assert str(tgt.sources[0]) == 'ggg.x.c', map(str, tgt.sources)
tgt = b(env, source=['h0.c', 'h1.c'])
- assert len(tgt) == 2, map(str, tgt)
- assert str(tgt[0]) == 'h0.o', map(str, tgt)
- assert str(tgt[1]) == 'h1.o', map(str, tgt)
- assert len(tgt[0].sources) == 2, map(str, tgt[0].sources)
- assert str(tgt[0].sources[0]) == 'h0.c', map(str, tgt[0].sources)
- assert str(tgt[0].sources[1]) == 'h1.c', map(str, tgt[0].sources)
- assert len(tgt[1].sources) == 2, map(str, tgt[1].sources)
- 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)
+ assert str(tgt) == 'h0.o', str(tgt)
+ assert len(tgt.sources) == 2, map(str, tgt.sources)
+ assert str(tgt.sources[0]) == 'h0.c', map(str, tgt.sources)
+ assert str(tgt.sources[1]) == 'h1.c', map(str, tgt.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)
+ assert str(tgt) == 'i0.o', str(tgt)
+ assert len(tgt.sources) == 2, map(str, tgt.sources)
+ assert str(tgt.sources[0]) == 'i0.w', map(str, tgt.sources)
+ assert str(tgt.sources[1]) == 'i1.y', map(str, tgt.sources)
if __name__ == "__main__":