summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-04-14 13:43:32 (GMT)
committerSteven Knight <knight@baldmt.com>2004-04-14 13:43:32 (GMT)
commite1989d22646b003f44677f43f9e2ddbbafd0ba62 (patch)
tree59ae71809d6fa17570cbb9c56cfec9034e93e4aa
parent73f9a42aaa603934e51ffb10bc256e9a3c17cd9b (diff)
downloadSCons-e1989d22646b003f44677f43f9e2ddbbafd0ba62.zip
SCons-e1989d22646b003f44677f43f9e2ddbbafd0ba62.tar.gz
SCons-e1989d22646b003f44677f43f9e2ddbbafd0ba62.tar.bz2
Filter null values from the _concat() list. (Chad Austin)
-rw-r--r--src/CHANGES.txt3
-rw-r--r--src/engine/SCons/Defaults.py23
-rw-r--r--test/LIBS.py8
3 files changed, 22 insertions, 12 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index bf2c760..b5ed500 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -22,6 +22,9 @@ RELEASE 0.96 - XXX
- Allow the emitter argument to a Builder() to be or expand to a list
of emitter functions, which will be called in sequence.
+ - Suppress null values in construction variables like $LIBS that use
+ the internal _concat() function.
+
From Chad Austin and Christoph Wiedemann:
- Add support for a $RPATH variable to supply a list of directories
diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py
index 94ab8d5..89ac0d3 100644
--- a/src/engine/SCons/Defaults.py
+++ b/src/engine/SCons/Defaults.py
@@ -173,20 +173,21 @@ def _concat(prefix, list, suffix, env, f=lambda x: x):
for x in list:
x = str(x)
+ if x:
- if prefix:
- if prefix[-1] == ' ':
- ret.append(prefix[:-1])
- elif x[:len(prefix)] != prefix:
- x = prefix + x
+ if prefix:
+ if prefix[-1] == ' ':
+ ret.append(prefix[:-1])
+ elif x[:len(prefix)] != prefix:
+ x = prefix + x
- ret.append(x)
+ ret.append(x)
- if suffix:
- if suffix[0] == ' ':
- ret.append(suffix[1:])
- elif x[-len(suffix):] != suffix:
- ret[-1] = ret[-1]+suffix
+ if suffix:
+ if suffix[0] == ' ':
+ ret.append(suffix[1:])
+ elif x[-len(suffix):] != suffix:
+ ret[-1] = ret[-1]+suffix
return ret
diff --git a/test/LIBS.py b/test/LIBS.py
index 645c625..c91e38d 100644
--- a/test/LIBS.py
+++ b/test/LIBS.py
@@ -42,6 +42,7 @@ foo1_exe = test.workpath('foo1' + _exe)
foo2_exe = test.workpath('foo2' + _exe)
foo3_exe = test.workpath('foo3' + _exe)
foo4_exe = test.workpath('foo4' + _exe)
+foo5_exe = test.workpath('foo5' + _exe)
test.write('SConstruct', """
env = Environment(LIBS=['bar'], LIBPATH = '.')
@@ -52,6 +53,8 @@ env3 = Environment(LIBS='bar', LIBPATH = '.')
env3.Program(target='foo3', source='foo3.c')
env4 = Environment(LIBS=File(r'%s'), LIBPATH = '.')
env4.Program(target='foo4', source='foo4.c')
+env5 = Environment(LIBS=['bar', '$UNSPECIFIED'], LIBPATH = '.')
+env5.Program(target='foo5', source='foo5.c')
SConscript('sub1/SConscript', 'env')
SConscript('sub2/SConscript', 'env')
""" % (bar_lib, bar_lib))
@@ -84,6 +87,7 @@ test.write('foo1.c', foo_contents)
test.write('foo2.c', foo_contents)
test.write('foo3.c', foo_contents)
test.write('foo4.c', foo_contents)
+test.write('foo5.c', foo_contents)
test.write(['sub1', 'bar.c'], r"""
#include <stdio.h>
@@ -112,12 +116,14 @@ void baz()
}
""")
-test.run(arguments = '.')
+# ar sometimes produces a "warning" on stderr -- ar: creating sub1/libbar.a
+test.run(arguments = '.', stderr=None)
test.run(program=foo1_exe, stdout='sub1/bar.c\nsub1/baz.c\n')
test.run(program=foo2_exe, stdout='sub1/bar.c\nsub1/baz.c\n')
test.run(program=foo3_exe, stdout='sub1/bar.c\nsub1/baz.c\n')
test.run(program=foo4_exe, stdout='sub1/bar.c\nsub1/baz.c\n')
+test.run(program=foo5_exe, stdout='sub1/bar.c\nsub1/baz.c\n')
#
test.write('SConstruct', """