diff options
author | Luca Falavigna <dktrkranz@debian.org> | 2010-06-15 09:21:32 +0000 |
---|---|---|
committer | Luca Falavigna <dktrkranz@debian.org> | 2010-06-15 09:21:32 +0000 |
commit | 07fc59e19636a4fc97a18b2038f3fe1c72a94000 (patch) | |
tree | 79d4a6239d81b2ccb4752d4f5ca25e0a7d3b4d4b /engine/SCons/Scanner/__init__.py | |
parent | 7f642861f3946d4241cbd668de258293ba92767a (diff) | |
parent | 340d57481935334465037d97c0db1555b70c0eb1 (diff) |
Merge commit 'upstream/2.0.0'
Diffstat (limited to 'engine/SCons/Scanner/__init__.py')
-rw-r--r-- | engine/SCons/Scanner/__init__.py | 36 |
1 files changed, 16 insertions, 20 deletions
diff --git a/engine/SCons/Scanner/__init__.py b/engine/SCons/Scanner/__init__.py index 987df51..2a6f299 100644 --- a/engine/SCons/Scanner/__init__.py +++ b/engine/SCons/Scanner/__init__.py @@ -27,16 +27,15 @@ 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 4720 2010/03/24 03:14:11 jars" +__revision__ = "src/engine/SCons/Scanner/__init__.py 5023 2010/06/14 22:05:46 scons" import re -import string import SCons.Node.FS import SCons.Util -class _Null: +class _Null(object): pass # This is used instead of None as a default argument value so None can be @@ -56,13 +55,13 @@ def Scanner(function, *args, **kw): patterned on SCons code. """ if SCons.Util.is_Dict(function): - return apply(Selector, (function,) + args, kw) + return Selector(function, *args, **kw) else: - return apply(Base, (function,) + args, kw) + return Base(function, *args, **kw) -class FindPathDirs: +class FindPathDirs(object): """A class to bind a specific *PATH variable name to a function that will return all of the *path directories.""" def __init__(self, variable): @@ -80,7 +79,7 @@ class FindPathDirs: -class Base: +class Base(object): """ The base class for dependency scanners. This implements straightforward, single-pass scanning of a single file. @@ -171,7 +170,7 @@ class Base: if skeys is _null: if SCons.Util.is_Dict(function): - skeys = function.keys() + skeys = list(function.keys()) else: skeys = [] self.skeys = skeys @@ -218,7 +217,7 @@ class Base: nodes = [] for l in list: if self.node_class and not isinstance(l, self.node_class): - l = apply(node_factory, (l,), kw) + l = node_factory(l, **kw) nodes.append(l) return nodes @@ -280,9 +279,9 @@ class Selector(Base): for custom modules that may be out there.) """ def __init__(self, dict, *args, **kw): - apply(Base.__init__, (self, None,)+args, kw) + Base.__init__(self, None, *args, **kw) self.dict = dict - self.skeys = dict.keys() + self.skeys = list(dict.keys()) def __call__(self, node, env, path = ()): return self.select(node)(node, env, path) @@ -309,7 +308,7 @@ class Current(Base): def current_check(node, env): return not node.has_builder() or node.is_up_to_date() kw['scan_check'] = current_check - apply(Base.__init__, (self,) + args, kw) + Base.__init__(self, *args, **kw) class Classic(Current): """ @@ -339,7 +338,7 @@ class Classic(Current): kw['skeys'] = suffixes kw['name'] = name - apply(Current.__init__, (self,) + args, kw) + Current.__init__(self, *args, **kw) def find_include(self, include, source_dir, path): n = SCons.Node.FS.find_file(include, (source_dir,) + tuple(path)) @@ -360,7 +359,7 @@ class Classic(Current): includes = self.find_include_names (node) # Intern the names of the include files. Saves some memory # if the same header is included many times. - node.includes = map(SCons.Util.silent_intern, includes) + node.includes = list(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 @@ -379,12 +378,9 @@ class Classic(Current): SCons.Warnings.warn(SCons.Warnings.DependencyWarning, "No dependency generated for file: %s (included from: %s) -- file not found" % (i, node)) else: - sortkey = self.sort_key(include) - nodes.append((sortkey, n)) + nodes.append((self.sort_key(include), n)) - nodes.sort() - nodes = map(lambda pair: pair[1], nodes) - return nodes + return [pair[1] for pair in sorted(nodes)] class ClassicCPP(Classic): """ @@ -408,7 +404,7 @@ class ClassicCPP(Classic): return n, i def sort_key(self, include): - return SCons.Node.FS._my_normcase(string.join(include)) + return SCons.Node.FS._my_normcase(' '.join(include)) # Local Variables: # tab-width:4 |