summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Scanner
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-11-09 06:41:02 (GMT)
committerSteven Knight <knight@baldmt.com>2003-11-09 06:41:02 (GMT)
commit9dd1434a94d2472b6f6d2956eb2b3e422d251a75 (patch)
tree55737b26b7c639ef87d93327c7adbd33722b1b71 /src/engine/SCons/Scanner
parent2016f443bfe0ffc6a380e24dc33ccee793a5ec96 (diff)
downloadSCons-9dd1434a94d2472b6f6d2956eb2b3e422d251a75.zip
SCons-9dd1434a94d2472b6f6d2956eb2b3e422d251a75.tar.gz
SCons-9dd1434a94d2472b6f6d2956eb2b3e422d251a75.tar.bz2
Allow LIBS to be a single element, not a list, and allow it to contain File nodes.
Diffstat (limited to 'src/engine/SCons/Scanner')
-rw-r--r--src/engine/SCons/Scanner/Prog.py13
-rw-r--r--src/engine/SCons/Scanner/ProgTests.py25
2 files changed, 36 insertions, 2 deletions
diff --git a/src/engine/SCons/Scanner/Prog.py b/src/engine/SCons/Scanner/Prog.py
index 6145ce0..650d26a 100644
--- a/src/engine/SCons/Scanner/Prog.py
+++ b/src/engine/SCons/Scanner/Prog.py
@@ -60,6 +60,8 @@ 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):
+ libs = [libs]
try:
prefix = env.Dictionary('LIBPREFIXES')
@@ -75,8 +77,15 @@ def scan(node, env, libpath = (), fs = SCons.Node.FS.default_fs):
except KeyError:
suffix = [ '' ]
+ find_file = SCons.Node.FS.find_file
ret = []
for suf in map(env.subst, suffix):
for pref in map(env.subst, prefix):
- ret.extend(map(lambda x, s=suf, p=pref: p + x + s, libs))
- return SCons.Node.FS.find_files(ret, libpath, fs.File)
+ for lib in libs:
+ if SCons.Util.is_String(lib):
+ f = find_file(pref + lib + suf, libpath, fs.File)
+ if f:
+ ret.append(f)
+ else:
+ ret.append(lib)
+ return ret
diff --git a/src/engine/SCons/Scanner/ProgTests.py b/src/engine/SCons/Scanner/ProgTests.py
index 98d9c78..9162b8e 100644
--- a/src/engine/SCons/Scanner/ProgTests.py
+++ b/src/engine/SCons/Scanner/ProgTests.py
@@ -30,6 +30,7 @@ import types
import unittest
import TestCmd
+import SCons.Node.FS
import SCons.Scanner.Prog
test = TestCmd.TestCmd(workdir = '')
@@ -90,6 +91,30 @@ class ProgScanTestCase1(unittest.TestCase):
deps = s('dummy', env, path)
assert deps_match(deps, ['l1.lib']), map(str, deps)
+ env = DummyEnvironment(LIBPATH=[ test.workpath("") ],
+ LIBS='l1')
+ s = SCons.Scanner.Prog.ProgScan()
+ path = s.path(env)
+ deps = s('dummy', env, path)
+ assert deps_match(deps, ['l1.lib']), map(str, deps)
+
+ f1 = SCons.Node.FS.default_fs.File(test.workpath('f1'))
+ env = DummyEnvironment(LIBPATH=[ test.workpath("") ],
+ LIBS=[f1])
+ s = SCons.Scanner.Prog.ProgScan()
+ path = s.path(env)
+ deps = s('dummy', env, path)
+ assert deps[0] is f1, deps
+
+ f2 = SCons.Node.FS.default_fs.File(test.workpath('f1'))
+ env = DummyEnvironment(LIBPATH=[ test.workpath("") ],
+ LIBS=f2)
+ s = SCons.Scanner.Prog.ProgScan()
+ path = s.path(env)
+ deps = s('dummy', env, path)
+ assert deps[0] is f2, deps
+
+
class ProgScanTestCase2(unittest.TestCase):
def runTest(self):
env = DummyEnvironment(LIBPATH=map(test.workpath,