summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/engine/SCons/Defaults.py2
-rw-r--r--src/engine/SCons/Scanner/Prog.py4
-rw-r--r--src/engine/SCons/Scanner/ProgTests.py17
-rw-r--r--test/LIBS.py22
4 files changed, 41 insertions, 4 deletions
diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py
index 6ebc6eb..381b0ae 100644
--- a/src/engine/SCons/Defaults.py
+++ b/src/engine/SCons/Defaults.py
@@ -232,6 +232,8 @@ def _concat(prefix, list, suffix, env, f=lambda x: x):
if not list:
return list
+ if SCons.Util.is_List(list):
+ list = SCons.Util.flatten(list)
list = f(env.subst_path(list))
result = []
diff --git a/src/engine/SCons/Scanner/Prog.py b/src/engine/SCons/Scanner/Prog.py
index 6efb44a..78b7233 100644
--- a/src/engine/SCons/Scanner/Prog.py
+++ b/src/engine/SCons/Scanner/Prog.py
@@ -52,7 +52,9 @@ def scan(node, env, libpath = (), fs = SCons.Node.FS.default_fs):
return []
if SCons.Util.is_String(libs):
libs = string.split(libs)
- elif not SCons.Util.is_List(libs):
+ elif SCons.Util.is_List(libs):
+ libs = SCons.Util.flatten(libs)
+ else:
libs = [libs]
try:
diff --git a/src/engine/SCons/Scanner/ProgTests.py b/src/engine/SCons/Scanner/ProgTests.py
index 1100f34..f7064ff 100644
--- a/src/engine/SCons/Scanner/ProgTests.py
+++ b/src/engine/SCons/Scanner/ProgTests.py
@@ -190,15 +190,26 @@ class ProgScanTestCase8(unittest.TestCase):
class DummyNode:
pass
- n = DummyNode()
+
+ n1 = DummyNode()
+ env = DummyEnvironment(LIBPATH=[ test.workpath("dir") ],
+ LIBS=[n1],
+ LIBPREFIXES=['p1-', 'p2-'],
+ LIBSUFFIXES=['.1', '2'])
+ s = SCons.Scanner.Prog.ProgScan(node_class = DummyNode)
+ path = s.path(env)
+ deps = s('dummy', env, path)
+ assert deps == [n1], deps
+
+ n2 = DummyNode()
env = DummyEnvironment(LIBPATH=[ test.workpath("dir") ],
- LIBS=[n],
+ LIBS=[n1, [n2]],
LIBPREFIXES=['p1-', 'p2-'],
LIBSUFFIXES=['.1', '2'])
s = SCons.Scanner.Prog.ProgScan(node_class = DummyNode)
path = s.path(env)
deps = s('dummy', env, path)
- assert deps == [n], deps
+ assert deps == [n1, n2], deps
def suite():
suite = unittest.TestSuite()
diff --git a/test/LIBS.py b/test/LIBS.py
index cc31cad..3ff26e0 100644
--- a/test/LIBS.py
+++ b/test/LIBS.py
@@ -43,6 +43,7 @@ foo2_exe = test.workpath('foo2' + _exe)
foo3_exe = test.workpath('foo3' + _exe)
foo4_exe = test.workpath('foo4' + _exe)
foo5_exe = test.workpath('foo5' + _exe)
+slprog_exe = test.workpath('slprog' + _exe)
test.write('SConstruct', """
env = Environment(LIBS=['bar'], LIBPATH = '.')
@@ -55,6 +56,8 @@ 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')
+sl = env.StaticLibrary('sl.c')
+env.Program(target='slprog.c', LIBS=[sl])
SConscript('sub1/SConscript', 'env')
SConscript('sub2/SConscript', 'env')
""" % (bar_lib, bar_lib))
@@ -89,6 +92,24 @@ test.write('foo3.c', foo_contents)
test.write('foo4.c', foo_contents)
test.write('foo5.c', foo_contents)
+test.write('sl.c', """\
+void
+sl(void)
+{
+ printf("sl.c\\n");
+}
+""")
+
+test.write('slprog.c', """\
+int
+main(int argc, char *argv[])
+{
+ sl();
+ printf("slprog.c\\n");
+ exit (0);
+}
+""")
+
test.write(['sub1', 'bar.c'], r"""
#include <stdio.h>
@@ -124,6 +145,7 @@ 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.run(program=slprog_exe, stdout='sl.c\nslprog.c\n')
#
test.write('SConstruct', """