summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-04-02 05:15:17 (GMT)
committerSteven Knight <knight@baldmt.com>2004-04-02 05:15:17 (GMT)
commit9175dc608055e832800472992feec71de3540f1a (patch)
treee01f6f7a9f49e22157c9d1d6c60c097e61439ef3 /src/engine/SCons
parent7d79f5147981e3af937f5e0293ad2a7ea8bdfd70 (diff)
downloadSCons-9175dc608055e832800472992feec71de3540f1a.zip
SCons-9175dc608055e832800472992feec71de3540f1a.tar.gz
SCons-9175dc608055e832800472992feec71de3540f1a.tar.bz2
Allow environment substitutions when referencing libraries. (Chad Austin)
Diffstat (limited to 'src/engine/SCons')
-rw-r--r--src/engine/SCons/Scanner/Prog.py1
-rw-r--r--src/engine/SCons/Scanner/ProgTests.py19
2 files changed, 20 insertions, 0 deletions
diff --git a/src/engine/SCons/Scanner/Prog.py b/src/engine/SCons/Scanner/Prog.py
index 0100b3d..3c45ca2 100644
--- a/src/engine/SCons/Scanner/Prog.py
+++ b/src/engine/SCons/Scanner/Prog.py
@@ -76,6 +76,7 @@ def scan(node, env, libpath = (), fs = SCons.Node.FS.default_fs):
for pref in map(env.subst, prefix):
for lib in libs:
if SCons.Util.is_String(lib):
+ lib = env.subst(lib)
lib = adjustixes(lib, pref, suf)
lib = find_file(lib, libpath, fs.File)
if lib:
diff --git a/src/engine/SCons/Scanner/ProgTests.py b/src/engine/SCons/Scanner/ProgTests.py
index 4e10488..f3a2755 100644
--- a/src/engine/SCons/Scanner/ProgTests.py
+++ b/src/engine/SCons/Scanner/ProgTests.py
@@ -71,6 +71,11 @@ class DummyEnvironment:
del self.Dictionary()[key]
def subst(self, s):
+ try:
+ if s[0] == '$':
+ return self._dict[s[1:]]
+ except IndexError:
+ return ''
return s
def subst_path(self, path):
@@ -167,6 +172,19 @@ class ProgScanTestCase6(unittest.TestCase):
deps = s('dummy', env, path)
assert deps_match(deps, ['dir/libfoo.a', 'dir/sub/libbar.a', 'dir/libxyz.other']), map(str, deps)
+class ProgScanTestCase7(unittest.TestCase):
+ def runTest(self):
+ env = DummyEnvironment(LIBPATH=[ test.workpath("dir") ],
+ LIBS=['foo', '$LIBBAR', '$XYZ'],
+ LIBPREFIXES=['lib'],
+ LIBSUFFIXES=['.a'],
+ LIBBAR='sub/libbar',
+ XYZ='xyz.other')
+ s = SCons.Scanner.Prog.ProgScan()
+ path = s.path(env)
+ deps = s('dummy', env, path)
+ assert deps_match(deps, ['dir/libfoo.a', 'dir/sub/libbar.a', 'dir/libxyz.other']), map(str, deps)
+
def suite():
suite = unittest.TestSuite()
suite.addTest(ProgScanTestCase1())
@@ -174,6 +192,7 @@ def suite():
suite.addTest(ProgScanTestCase3())
suite.addTest(ProgScanTestCase5())
suite.addTest(ProgScanTestCase6())
+ suite.addTest(ProgScanTestCase7())
if hasattr(types, 'UnicodeType'):
code = """if 1:
class ProgScanTestCase4(unittest.TestCase):