diff options
| author | Steven Knight <knight@baldmt.com> | 2003-12-12 16:36:41 (GMT) |
|---|---|---|
| committer | Steven Knight <knight@baldmt.com> | 2003-12-12 16:36:41 (GMT) |
| commit | cde0b273458b25194d63499f24abb877085eb47e (patch) | |
| tree | 21c67581310fd3f05e2e2f987939597461ca429d /src/engine/SCons/Scanner | |
| parent | 5d901003397326b8735482823a1221af8fe1acb4 (diff) | |
| download | SCons-cde0b273458b25194d63499f24abb877085eb47e.zip SCons-cde0b273458b25194d63499f24abb877085eb47e.tar.gz SCons-cde0b273458b25194d63499f24abb877085eb47e.tar.bz2 | |
Fix stripping the library prefix.
Diffstat (limited to 'src/engine/SCons/Scanner')
| -rw-r--r-- | src/engine/SCons/Scanner/Prog.py | 14 | ||||
| -rw-r--r-- | src/engine/SCons/Scanner/ProgTests.py | 25 |
2 files changed, 27 insertions, 12 deletions
diff --git a/src/engine/SCons/Scanner/Prog.py b/src/engine/SCons/Scanner/Prog.py index 650d26a..5b3c935 100644 --- a/src/engine/SCons/Scanner/Prog.py +++ b/src/engine/SCons/Scanner/Prog.py @@ -78,14 +78,16 @@ def scan(node, env, libpath = (), fs = SCons.Node.FS.default_fs): suffix = [ '' ] find_file = SCons.Node.FS.find_file - ret = [] + adjustixes = SCons.Util.adjustixes + result = [] for suf in map(env.subst, suffix): for pref in map(env.subst, prefix): for lib in libs: if SCons.Util.is_String(lib): - f = find_file(pref + lib + suf, libpath, fs.File) - if f: - ret.append(f) + lib = adjustixes(lib, pref, suf) + lib = find_file(lib, libpath, fs.File) + if lib: + result.append(lib) else: - ret.append(lib) - return ret + result.append(lib) + return result diff --git a/src/engine/SCons/Scanner/ProgTests.py b/src/engine/SCons/Scanner/ProgTests.py index 9162b8e..9f178f8 100644 --- a/src/engine/SCons/Scanner/ProgTests.py +++ b/src/engine/SCons/Scanner/ProgTests.py @@ -35,20 +35,21 @@ import SCons.Scanner.Prog test = TestCmd.TestCmd(workdir = '') -test.subdir('d1', ['d1', 'd2']) +test.subdir('d1', ['d1', 'd2'], 'dir', ['dir', 'sub']) -libs = [ 'l1.lib', 'd1/l2.lib', 'd1/d2/l3.lib' ] +libs = [ 'l1.lib', 'd1/l2.lib', 'd1/d2/l3.lib', + 'dir/libfoo.a', 'dir/sub/libbar.a', 'dir/libxyz.other'] for h in libs: - test.write(h, " ") + test.write(h, "\n") # define some helpers: class DummyEnvironment: def __init__(self, **kw): - self._dict = kw - self._dict['LIBSUFFIXES'] = '.lib' - + self._dict = {'LIBSUFFIXES' : '.lib'} + self._dict.update(kw) + def Dictionary(self, *args): if not args: return self._dict @@ -150,12 +151,24 @@ class ProgScanTestCase5(unittest.TestCase): deps = s('dummy', env, path) assert deps_match(deps, [ 'd1/l2.lib' ]), map(str, deps) +class ProgScanTestCase6(unittest.TestCase): + def runTest(self): + env = DummyEnvironment(LIBPATH=[ test.workpath("dir") ], + LIBS=['foo', 'sub/libbar', 'xyz.other'], + LIBPREFIXES=['lib'], + LIBSUFFIXES=['.a']) + 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()) suite.addTest(ProgScanTestCase2()) suite.addTest(ProgScanTestCase3()) suite.addTest(ProgScanTestCase5()) + suite.addTest(ProgScanTestCase6()) if hasattr(types, 'UnicodeType'): code = """if 1: class ProgScanTestCase4(unittest.TestCase): |
