diff options
Diffstat (limited to 'src/engine/SCons/Scanner')
-rw-r--r-- | src/engine/SCons/Scanner/C.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/CTests.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/D.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/Dir.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/DirTests.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/Fortran.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/FortranTests.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/IDL.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/IDLTests.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/LaTeX.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/LaTeXTests.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/Prog.py | 29 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/ProgTests.py | 39 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/RC.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/RCTests.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/ScannerTests.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/__init__.py | 4 | ||||
-rw-r--r-- | src/engine/SCons/Scanner/__init__.xml | 2 |
18 files changed, 84 insertions, 46 deletions
diff --git a/src/engine/SCons/Scanner/C.py b/src/engine/SCons/Scanner/C.py index 0effa3b..1e8dcbb 100644 --- a/src/engine/SCons/Scanner/C.py +++ b/src/engine/SCons/Scanner/C.py @@ -5,7 +5,7 @@ This module implements the depenency scanner for C/C++ code. """ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -27,7 +27,7 @@ This module implements the depenency scanner for C/C++ code. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/C.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/C.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import SCons.Node.FS import SCons.Scanner diff --git a/src/engine/SCons/Scanner/CTests.py b/src/engine/SCons/Scanner/CTests.py index c85d4df..1482837 100644 --- a/src/engine/SCons/Scanner/CTests.py +++ b/src/engine/SCons/Scanner/CTests.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/CTests.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/CTests.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import SCons.compat diff --git a/src/engine/SCons/Scanner/D.py b/src/engine/SCons/Scanner/D.py index 501ff65..c7963df 100644 --- a/src/engine/SCons/Scanner/D.py +++ b/src/engine/SCons/Scanner/D.py @@ -8,7 +8,7 @@ Coded by Andy Friesen """ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -30,7 +30,7 @@ Coded by Andy Friesen # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/D.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/D.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import re diff --git a/src/engine/SCons/Scanner/Dir.py b/src/engine/SCons/Scanner/Dir.py index 3feb24a..5054ad5 100644 --- a/src/engine/SCons/Scanner/Dir.py +++ b/src/engine/SCons/Scanner/Dir.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -20,7 +20,7 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "src/engine/SCons/Scanner/Dir.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/Dir.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import SCons.Node.FS import SCons.Scanner diff --git a/src/engine/SCons/Scanner/DirTests.py b/src/engine/SCons/Scanner/DirTests.py index 6fd4ba6..ec4614b 100644 --- a/src/engine/SCons/Scanner/DirTests.py +++ b/src/engine/SCons/Scanner/DirTests.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/DirTests.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/DirTests.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import os.path import sys diff --git a/src/engine/SCons/Scanner/Fortran.py b/src/engine/SCons/Scanner/Fortran.py index c0db8ef..ff14a8c 100644 --- a/src/engine/SCons/Scanner/Fortran.py +++ b/src/engine/SCons/Scanner/Fortran.py @@ -5,7 +5,7 @@ This module implements the dependency scanner for Fortran code. """ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -26,7 +26,7 @@ This module implements the dependency scanner for Fortran code. # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "src/engine/SCons/Scanner/Fortran.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/Fortran.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import re diff --git a/src/engine/SCons/Scanner/FortranTests.py b/src/engine/SCons/Scanner/FortranTests.py index 9c2700b..d2bcb79 100644 --- a/src/engine/SCons/Scanner/FortranTests.py +++ b/src/engine/SCons/Scanner/FortranTests.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/FortranTests.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/FortranTests.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import os import os.path diff --git a/src/engine/SCons/Scanner/IDL.py b/src/engine/SCons/Scanner/IDL.py index fcdc890..2dcf4e0 100644 --- a/src/engine/SCons/Scanner/IDL.py +++ b/src/engine/SCons/Scanner/IDL.py @@ -6,7 +6,7 @@ Definition Language) files. """ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -28,7 +28,7 @@ Definition Language) files. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/IDL.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/IDL.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import SCons.Node.FS import SCons.Scanner diff --git a/src/engine/SCons/Scanner/IDLTests.py b/src/engine/SCons/Scanner/IDLTests.py index 92cc62f..324017e 100644 --- a/src/engine/SCons/Scanner/IDLTests.py +++ b/src/engine/SCons/Scanner/IDLTests.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/IDLTests.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/IDLTests.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import unittest import sys diff --git a/src/engine/SCons/Scanner/LaTeX.py b/src/engine/SCons/Scanner/LaTeX.py index 1ef81eb..906fbb3 100644 --- a/src/engine/SCons/Scanner/LaTeX.py +++ b/src/engine/SCons/Scanner/LaTeX.py @@ -5,7 +5,7 @@ This module implements the dependency scanner for LaTeX code. """ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -27,7 +27,7 @@ This module implements the dependency scanner for LaTeX code. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/LaTeX.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/LaTeX.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import os.path import re diff --git a/src/engine/SCons/Scanner/LaTeXTests.py b/src/engine/SCons/Scanner/LaTeXTests.py index 0807cc4..96afff9 100644 --- a/src/engine/SCons/Scanner/LaTeXTests.py +++ b/src/engine/SCons/Scanner/LaTeXTests.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/LaTeXTests.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/LaTeXTests.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import SCons.compat diff --git a/src/engine/SCons/Scanner/Prog.py b/src/engine/SCons/Scanner/Prog.py index 3bbc0f4..756f67d 100644 --- a/src/engine/SCons/Scanner/Prog.py +++ b/src/engine/SCons/Scanner/Prog.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/Prog.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/Prog.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import SCons.Node import SCons.Node.FS @@ -38,6 +38,24 @@ def ProgramScanner(**kw): ps = SCons.Scanner.Base(scan, "ProgramScanner", **kw) return ps +def _subst_libs(env, libs): + """ + Substitute environment variables and split into list. + """ + if SCons.Util.is_String(libs): + libs = env.subst(libs) + if SCons.Util.is_String(libs): + libs = libs.split() + elif SCons.Util.is_Sequence(libs): + _libs = [] + for l in libs: + _libs += _subst_libs(env, l) + libs = _libs + else: + # libs is an object (Node, for example) + libs = [libs] + return libs + def scan(node, env, libpath = ()): """ This scanner scans program files for static-library @@ -50,10 +68,8 @@ def scan(node, env, libpath = ()): except KeyError: # There are no LIBS in this environment, so just return a null list: return [] - if SCons.Util.is_String(libs): - libs = libs.split() - else: - libs = SCons.Util.flatten(libs) + + libs = _subst_libs(env, libs) try: prefix = env['LIBPREFIXES'] @@ -83,7 +99,6 @@ def scan(node, env, libpath = ()): adjustixes = SCons.Util.adjustixes for lib in libs: if SCons.Util.is_String(lib): - lib = env.subst(lib) for pref, suf in pairs: l = adjustixes(lib, pref, suf) l = find_file(l, libpath, verbose=print_find_libs) diff --git a/src/engine/SCons/Scanner/ProgTests.py b/src/engine/SCons/Scanner/ProgTests.py index 08fcaa7..1789ac2 100644 --- a/src/engine/SCons/Scanner/ProgTests.py +++ b/src/engine/SCons/Scanner/ProgTests.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/ProgTests.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/ProgTests.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import os.path import sys @@ -32,6 +32,7 @@ import TestUnit import SCons.Node.FS import SCons.Scanner.Prog +import SCons.Subst test = TestCmd.TestCmd(workdir = '') @@ -72,12 +73,7 @@ class DummyEnvironment(object): del self.Dictionary()[key] def subst(self, s, target=None, source=None, conv=None): - try: - if s[0] == '$': - return self._dict[s[1:]] - except IndexError: - return '' - return s + return SCons.Subst.scons_subst(s, self, gvars=self._dict, lvars=self._dict) def subst_path(self, path, target=None, source=None, conv=None): if not isinstance(path, list): @@ -223,6 +219,31 @@ class ProgramScannerTestCase8(unittest.TestCase): deps = s(DummyNode('dummy'), env, path) assert deps == [n1, n2], deps +class ProgramScannerTestCase9(unittest.TestCase): + def runTest(self): + env = DummyEnvironment(LIBPATH=[ test.workpath("dir") ], + LIBS=['foo', '$LIBBAR'], + LIBPREFIXES=['lib'], + LIBSUFFIXES=['.a'], + LIBBAR=['sub/libbar', 'xyz.other']) + s = SCons.Scanner.Prog.ProgramScanner() + path = s.path(env) + deps = s(DummyNode('dummy'), env, path) + assert deps_match(deps, ['dir/libfoo.a', 'dir/sub/libbar.a', 'dir/libxyz.other']), list(map(str, deps)) + +class ProgramScannerTestCase10(unittest.TestCase): + def runTest(self): + env = DummyEnvironment(LIBPATH=[ test.workpath("dir") ], + LIBS=['foo', '$LIBBAR'], + LIBPREFIXES=['lib'], + LIBSUFFIXES=['.a'], + LIBBAR='sub/libbar $LIBBAR2', + LIBBAR2=['xyz.other']) + s = SCons.Scanner.Prog.ProgramScanner() + path = s.path(env) + deps = s(DummyNode('dummy'), env, path) + assert deps_match(deps, ['dir/libfoo.a', 'dir/sub/libbar.a', 'dir/libxyz.other']), list(map(str, deps)) + def suite(): suite = unittest.TestSuite() suite.addTest(ProgramScannerTestCase1()) @@ -232,6 +253,8 @@ def suite(): suite.addTest(ProgramScannerTestCase6()) suite.addTest(ProgramScannerTestCase7()) suite.addTest(ProgramScannerTestCase8()) + suite.addTest(ProgramScannerTestCase9()) + suite.addTest(ProgramScannerTestCase10()) try: unicode except NameError: pass else: diff --git a/src/engine/SCons/Scanner/RC.py b/src/engine/SCons/Scanner/RC.py index ceba01f..d4eacb9 100644 --- a/src/engine/SCons/Scanner/RC.py +++ b/src/engine/SCons/Scanner/RC.py @@ -6,7 +6,7 @@ Definition Language) files. """ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -28,7 +28,7 @@ Definition Language) files. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/RC.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/RC.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import SCons.Node.FS import SCons.Scanner diff --git a/src/engine/SCons/Scanner/RCTests.py b/src/engine/SCons/Scanner/RCTests.py index d13a5df..09785b6 100644 --- a/src/engine/SCons/Scanner/RCTests.py +++ b/src/engine/SCons/Scanner/RCTests.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -21,7 +21,7 @@ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/RCTests.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/RCTests.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import unittest import sys diff --git a/src/engine/SCons/Scanner/ScannerTests.py b/src/engine/SCons/Scanner/ScannerTests.py index a1e83a0..595a5d8 100644 --- a/src/engine/SCons/Scanner/ScannerTests.py +++ b/src/engine/SCons/Scanner/ScannerTests.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -20,7 +20,7 @@ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -__revision__ = "src/engine/SCons/Scanner/ScannerTests.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/ScannerTests.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import SCons.compat diff --git a/src/engine/SCons/Scanner/__init__.py b/src/engine/SCons/Scanner/__init__.py index 1a5fab1..9e37527 100644 --- a/src/engine/SCons/Scanner/__init__.py +++ b/src/engine/SCons/Scanner/__init__.py @@ -5,7 +5,7 @@ The Scanner package for the SCons software construction utility. """ # -# Copyright (c) 2001 - 2014 The SCons Foundation +# Copyright (c) 2001 - 2015 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the @@ -27,7 +27,7 @@ The Scanner package for the SCons software construction utility. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/__init__.py 2014/09/27 12:51:43 garyo" +__revision__ = "src/engine/SCons/Scanner/__init__.py pchdll:3325:cd517fae59a4 2015/06/18 06:53:27 bdbaddog" import re diff --git a/src/engine/SCons/Scanner/__init__.xml b/src/engine/SCons/Scanner/__init__.xml index f6d8660..7790dc9 100644 --- a/src/engine/SCons/Scanner/__init__.xml +++ b/src/engine/SCons/Scanner/__init__.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <!-- -Copyright (c) 2001 - 2014 The SCons Foundation +Copyright (c) 2001 - 2015 The SCons Foundation This file is processed by the bin/SConsDoc.py module. See its __doc__ string for a discussion of the format. |