diff options
Diffstat (limited to 'engine/SCons/Scanner')
-rw-r--r-- | engine/SCons/Scanner/C.py | 4 | ||||
-rw-r--r-- | engine/SCons/Scanner/D.py | 4 | ||||
-rw-r--r-- | engine/SCons/Scanner/Dir.py | 4 | ||||
-rw-r--r-- | engine/SCons/Scanner/Fortran.py | 4 | ||||
-rw-r--r-- | engine/SCons/Scanner/IDL.py | 4 | ||||
-rw-r--r-- | engine/SCons/Scanner/LaTeX.py | 47 | ||||
-rw-r--r-- | engine/SCons/Scanner/Prog.py | 4 | ||||
-rw-r--r-- | engine/SCons/Scanner/RC.py | 4 | ||||
-rw-r--r-- | engine/SCons/Scanner/__init__.py | 4 |
9 files changed, 56 insertions, 23 deletions
diff --git a/engine/SCons/Scanner/C.py b/engine/SCons/Scanner/C.py index bc44e66..453310d 100644 --- a/engine/SCons/Scanner/C.py +++ b/engine/SCons/Scanner/C.py @@ -5,7 +5,7 @@ This module implements the depenency scanner for C/C++ code. """ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 4577 2009/12/27 19:43:56 scons" +__revision__ = "src/engine/SCons/Scanner/C.py 4629 2010/01/17 22:23:21 scons" import SCons.Node.FS import SCons.Scanner diff --git a/engine/SCons/Scanner/D.py b/engine/SCons/Scanner/D.py index df9b99a..e1cb350 100644 --- a/engine/SCons/Scanner/D.py +++ b/engine/SCons/Scanner/D.py @@ -8,7 +8,7 @@ Coded by Andy Friesen """ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 4577 2009/12/27 19:43:56 scons" +__revision__ = "src/engine/SCons/Scanner/D.py 4629 2010/01/17 22:23:21 scons" import re import string diff --git a/engine/SCons/Scanner/Dir.py b/engine/SCons/Scanner/Dir.py index 2d0a8b3..c2ba897 100644 --- a/engine/SCons/Scanner/Dir.py +++ b/engine/SCons/Scanner/Dir.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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/Dir.py 4577 2009/12/27 19:43:56 scons" +__revision__ = "src/engine/SCons/Scanner/Dir.py 4629 2010/01/17 22:23:21 scons" import SCons.Node.FS import SCons.Scanner diff --git a/engine/SCons/Scanner/Fortran.py b/engine/SCons/Scanner/Fortran.py index c0ac91f..5b31e24 100644 --- a/engine/SCons/Scanner/Fortran.py +++ b/engine/SCons/Scanner/Fortran.py @@ -5,7 +5,7 @@ This module implements the dependency scanner for Fortran code. """ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 Fortran code. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # -__revision__ = "src/engine/SCons/Scanner/Fortran.py 4577 2009/12/27 19:43:56 scons" +__revision__ = "src/engine/SCons/Scanner/Fortran.py 4629 2010/01/17 22:23:21 scons" import re import string diff --git a/engine/SCons/Scanner/IDL.py b/engine/SCons/Scanner/IDL.py index 683e9bb..22afd95 100644 --- a/engine/SCons/Scanner/IDL.py +++ b/engine/SCons/Scanner/IDL.py @@ -6,7 +6,7 @@ Definition Language) files. """ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 4577 2009/12/27 19:43:56 scons" +__revision__ = "src/engine/SCons/Scanner/IDL.py 4629 2010/01/17 22:23:21 scons" import SCons.Node.FS import SCons.Scanner diff --git a/engine/SCons/Scanner/LaTeX.py b/engine/SCons/Scanner/LaTeX.py index 761a584..a3395f1 100644 --- a/engine/SCons/Scanner/LaTeX.py +++ b/engine/SCons/Scanner/LaTeX.py @@ -5,7 +5,7 @@ This module implements the dependency scanner for LaTeX code. """ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 4577 2009/12/27 19:43:56 scons" +__revision__ = "src/engine/SCons/Scanner/LaTeX.py 4629 2010/01/17 22:23:21 scons" import os.path import string @@ -182,7 +182,7 @@ class LaTeX(SCons.Scanner.Base): node = node.rfile() if not node.exists(): return [] - return self.scan(node, path) + return self.scan_recurse(node, path) class FindMultiPathDirs: """The stock FindPathDirs function has the wrong granularity: @@ -226,7 +226,7 @@ class LaTeX(SCons.Scanner.Base): kw['function'] = _scan kw['path_function'] = FindMultiPathDirs(LaTeX.keyword_paths) - kw['recursive'] = 1 + kw['recursive'] = 0 kw['skeys'] = suffixes kw['scan_check'] = LaTeXScanCheck(suffixes) kw['name'] = name @@ -279,13 +279,13 @@ class LaTeX(SCons.Scanner.Base): return i, include return i, include - def scan(self, node, path=()): + def scan(self, node): # Modify the default scan function to allow for the regular # expression to return a comma separated list of file names # as can be the case with the bibliography keyword. # Cache the includes list in node so we only scan it once: - path_dict = dict(list(path)) + # path_dict = dict(list(path)) noopt_cre = re.compile('\[.*$') if node.includes != None: includes = node.includes @@ -310,6 +310,19 @@ class LaTeX(SCons.Scanner.Base): includes = split_includes node.includes = includes + return includes + + def scan_recurse(self, node, path=()): + """ do a recursive scan of the top level target file + This lets us search for included files based on the + directory of the main file just as latex does""" + + path_dict = dict(list(path)) + + queue = [] + queue.extend( self.scan(node) ) + seen = {} + # This is a hand-coded DSU (decorate-sort-undecorate, or # Schwartzian transform) pattern. The sort key is the raw name # of the file as specifed on the \include, \input, etc. line. @@ -319,7 +332,24 @@ class LaTeX(SCons.Scanner.Base): # is actually found in a Repository or locally.""" nodes = [] source_dir = node.get_dir() - for include in includes: + #for include in includes: + while queue: + + include = queue.pop() + # TODO(1.5): more compact: + #try: + # if seen[include[1]] == 1: + # continue + #except KeyError: + # seen[include[1]] = 1 + try: + already_seen = seen[include[1]] + except KeyError: + seen[include[1]] = 1 + already_seen = False + if already_seen: + continue + # # Handle multiple filenames in include[1] # @@ -333,6 +363,9 @@ class LaTeX(SCons.Scanner.Base): else: sortkey = self.sort_key(n) nodes.append((sortkey, n)) + # recurse down + queue.extend( self.scan(n) ) + # nodes.sort() nodes = map(lambda pair: pair[1], nodes) diff --git a/engine/SCons/Scanner/Prog.py b/engine/SCons/Scanner/Prog.py index d0ba16b..37bf2a0 100644 --- a/engine/SCons/Scanner/Prog.py +++ b/engine/SCons/Scanner/Prog.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 4577 2009/12/27 19:43:56 scons" +__revision__ = "src/engine/SCons/Scanner/Prog.py 4629 2010/01/17 22:23:21 scons" import string diff --git a/engine/SCons/Scanner/RC.py b/engine/SCons/Scanner/RC.py index 243de3c..a1bdf77 100644 --- a/engine/SCons/Scanner/RC.py +++ b/engine/SCons/Scanner/RC.py @@ -6,7 +6,7 @@ Definition Language) files. """ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 4577 2009/12/27 19:43:56 scons" +__revision__ = "src/engine/SCons/Scanner/RC.py 4629 2010/01/17 22:23:21 scons" import SCons.Node.FS import SCons.Scanner diff --git a/engine/SCons/Scanner/__init__.py b/engine/SCons/Scanner/__init__.py index 7e72504..83ca110 100644 --- a/engine/SCons/Scanner/__init__.py +++ b/engine/SCons/Scanner/__init__.py @@ -5,7 +5,7 @@ The Scanner package for the SCons software construction utility. """ # -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation +# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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 4577 2009/12/27 19:43:56 scons" +__revision__ = "src/engine/SCons/Scanner/__init__.py 4629 2010/01/17 22:23:21 scons" import re import string |