diff options
author | Remko Tronçon <git@el-tramo.be> | 2010-04-11 18:14:19 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2010-04-11 18:14:56 (GMT) |
commit | d9a29f93cd4ff505e264974febd0566ae29880ca (patch) | |
tree | 6eea9e476374863e93c80aacb76840ac24f0c50f /3rdParty/SCons/scons-local/SCons/Scanner | |
parent | 73f845a3f380c5a1adbac2cf29e9f36cc9b498cf (diff) | |
download | swift-d9a29f93cd4ff505e264974febd0566ae29880ca.zip swift-d9a29f93cd4ff505e264974febd0566ae29880ca.tar.bz2 |
Update SCons to 1.3.0.d20100404.
Diffstat (limited to '3rdParty/SCons/scons-local/SCons/Scanner')
-rw-r--r-- | 3rdParty/SCons/scons-local/SCons/Scanner/C.py | 4 | ||||
-rw-r--r-- | 3rdParty/SCons/scons-local/SCons/Scanner/D.py | 4 | ||||
-rw-r--r-- | 3rdParty/SCons/scons-local/SCons/Scanner/Dir.py | 4 | ||||
-rw-r--r-- | 3rdParty/SCons/scons-local/SCons/Scanner/Fortran.py | 4 | ||||
-rw-r--r-- | 3rdParty/SCons/scons-local/SCons/Scanner/IDL.py | 4 | ||||
-rw-r--r-- | 3rdParty/SCons/scons-local/SCons/Scanner/LaTeX.py | 53 | ||||
-rw-r--r-- | 3rdParty/SCons/scons-local/SCons/Scanner/Prog.py | 4 | ||||
-rw-r--r-- | 3rdParty/SCons/scons-local/SCons/Scanner/RC.py | 4 | ||||
-rw-r--r-- | 3rdParty/SCons/scons-local/SCons/Scanner/__init__.py | 18 |
9 files changed, 67 insertions, 32 deletions
diff --git a/3rdParty/SCons/scons-local/SCons/Scanner/C.py b/3rdParty/SCons/scons-local/SCons/Scanner/C.py index dccd3be..cc6ab64 100644 --- a/3rdParty/SCons/scons-local/SCons/Scanner/C.py +++ b/3rdParty/SCons/scons-local/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 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Scanner/C.py 4761 2010/04/04 14:04:44 bdeegan" import SCons.Node.FS import SCons.Scanner diff --git a/3rdParty/SCons/scons-local/SCons/Scanner/D.py b/3rdParty/SCons/scons-local/SCons/Scanner/D.py index 311e1af..509f7eb 100644 --- a/3rdParty/SCons/scons-local/SCons/Scanner/D.py +++ b/3rdParty/SCons/scons-local/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 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Scanner/D.py 4761 2010/04/04 14:04:44 bdeegan" import re import string diff --git a/3rdParty/SCons/scons-local/SCons/Scanner/Dir.py b/3rdParty/SCons/scons-local/SCons/Scanner/Dir.py index aaf92d6..5e21a68 100644 --- a/3rdParty/SCons/scons-local/SCons/Scanner/Dir.py +++ b/3rdParty/SCons/scons-local/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 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Scanner/Dir.py 4761 2010/04/04 14:04:44 bdeegan" import SCons.Node.FS import SCons.Scanner diff --git a/3rdParty/SCons/scons-local/SCons/Scanner/Fortran.py b/3rdParty/SCons/scons-local/SCons/Scanner/Fortran.py index 92f511a..572b183 100644 --- a/3rdParty/SCons/scons-local/SCons/Scanner/Fortran.py +++ b/3rdParty/SCons/scons-local/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 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Scanner/Fortran.py 4761 2010/04/04 14:04:44 bdeegan" import re import string diff --git a/3rdParty/SCons/scons-local/SCons/Scanner/IDL.py b/3rdParty/SCons/scons-local/SCons/Scanner/IDL.py index 57a8a6a..21fcc45 100644 --- a/3rdParty/SCons/scons-local/SCons/Scanner/IDL.py +++ b/3rdParty/SCons/scons-local/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 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Scanner/IDL.py 4761 2010/04/04 14:04:44 bdeegan" import SCons.Node.FS import SCons.Scanner diff --git a/3rdParty/SCons/scons-local/SCons/Scanner/LaTeX.py b/3rdParty/SCons/scons-local/SCons/Scanner/LaTeX.py index fe6f7e1..4b2c832 100644 --- a/3rdParty/SCons/scons-local/SCons/Scanner/LaTeX.py +++ b/3rdParty/SCons/scons-local/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 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Scanner/LaTeX.py 4761 2010/04/04 14:04:44 bdeegan" import os.path import string @@ -151,6 +151,7 @@ class LaTeX(SCons.Scanner.Base): of the file being searched: env['TEXINPUTS'] for "input" and "include" keywords env['TEXINPUTS'] for "includegraphics" keyword + env['TEXINPUTS'] for "lstinputlisting" keyword env['BIBINPUTS'] for "bibliography" keyword env['BSTINPUTS'] for "bibliographystyle" keyword @@ -162,7 +163,8 @@ class LaTeX(SCons.Scanner.Base): 'includegraphics': 'TEXINPUTS', 'bibliography': 'BIBINPUTS', 'bibliographystyle': 'BSTINPUTS', - 'usepackage': 'TEXINPUTS'} + 'usepackage': 'TEXINPUTS', + 'lstinputlisting': 'TEXINPUTS'} env_variables = SCons.Util.unique(keyword_paths.values()) def __init__(self, name, suffixes, graphics_extensions, *args, **kw): @@ -172,7 +174,7 @@ class LaTeX(SCons.Scanner.Base): # Without the \n, the ^ could match the beginning of a *previous* # line followed by one or more newline characters (i.e. blank # lines), interfering with a match on the next line. - regex = r'^[^%\n]*\\(include|includegraphics(?:\[[^\]]+\])?|input|bibliography|usepackage){([^}]*)}' + regex = r'^[^%\n]*\\(include|includegraphics(?:\[[^\]]+\])?|lstinputlisting(?:\[[^\]]+\])?|input|bibliography|usepackage){([^}]*)}' self.cre = re.compile(regex, re.M) self.graphics_extensions = graphics_extensions @@ -180,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: @@ -224,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 @@ -277,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 @@ -308,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. @@ -317,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] # @@ -331,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/3rdParty/SCons/scons-local/SCons/Scanner/Prog.py b/3rdParty/SCons/scons-local/SCons/Scanner/Prog.py index 47054a8..f5f94a4 100644 --- a/3rdParty/SCons/scons-local/SCons/Scanner/Prog.py +++ b/3rdParty/SCons/scons-local/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 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Scanner/Prog.py 4761 2010/04/04 14:04:44 bdeegan" import string diff --git a/3rdParty/SCons/scons-local/SCons/Scanner/RC.py b/3rdParty/SCons/scons-local/SCons/Scanner/RC.py index e804a3f..b89442b 100644 --- a/3rdParty/SCons/scons-local/SCons/Scanner/RC.py +++ b/3rdParty/SCons/scons-local/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 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Scanner/RC.py 4761 2010/04/04 14:04:44 bdeegan" import SCons.Node.FS import SCons.Scanner diff --git a/3rdParty/SCons/scons-local/SCons/Scanner/__init__.py b/3rdParty/SCons/scons-local/SCons/Scanner/__init__.py index f5ce271..b7eb2d8 100644 --- a/3rdParty/SCons/scons-local/SCons/Scanner/__init__.py +++ b/3rdParty/SCons/scons-local/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 4043 2009/02/23 09:06:45 scons" +__revision__ = "src/engine/SCons/Scanner/__init__.py 4761 2010/04/04 14:04:44 bdeegan" import re import string @@ -92,7 +92,9 @@ class Base: argument = _null, skeys = _null, path_function = None, - node_class = SCons.Node.FS.Entry, + # Node.FS.Base so that, by default, it's okay for a + # scanner to return a Dir, File or Entry. + node_class = SCons.Node.FS.Base, node_factory = None, scan_check = None, recursive = None): @@ -352,16 +354,13 @@ class Classic(Current): def scan(self, node, path=()): # cache the includes list in node so we only scan it once: - if node.includes != None: + if node.includes is not None: includes = node.includes else: includes = self.find_include_names (node) # Intern the names of the include files. Saves some memory # if the same header is included many times. - try: - node.includes = map(intern, includes) - except TypeError: - node.includes = includes + node.includes = map(SCons.Util.silent_intern, includes) # This is a hand-coded DSU (decorate-sort-undecorate, or # Schwartzian transform) pattern. The sort key is the raw name @@ -405,7 +404,8 @@ class ClassicCPP(Classic): n = SCons.Node.FS.find_file(include[1], paths) - return n, intern(include[1]) + i = SCons.Util.silent_intern(include[1]) + return n, i def sort_key(self, include): return SCons.Node.FS._my_normcase(string.join(include)) |