summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/SCons/scons-local/SCons/Node')
-rw-r--r--3rdParty/SCons/scons-local/SCons/Node/Alias.py4
-rw-r--r--3rdParty/SCons/scons-local/SCons/Node/FS.py94
-rw-r--r--3rdParty/SCons/scons-local/SCons/Node/Python.py11
-rw-r--r--3rdParty/SCons/scons-local/SCons/Node/__init__.py12
4 files changed, 89 insertions, 32 deletions
diff --git a/3rdParty/SCons/scons-local/SCons/Node/Alias.py b/3rdParty/SCons/scons-local/SCons/Node/Alias.py
index a52a3fb..84be60b 100644
--- a/3rdParty/SCons/scons-local/SCons/Node/Alias.py
+++ b/3rdParty/SCons/scons-local/SCons/Node/Alias.py
@@ -8,7 +8,7 @@ This creates a hash of global Aliases (dummy targets).
"""
#
-# 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 @@ This creates a hash of global Aliases (dummy targets).
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Node/Alias.py 4043 2009/02/23 09:06:45 scons"
+__revision__ = "src/engine/SCons/Node/Alias.py 4761 2010/04/04 14:04:44 bdeegan"
import string
import UserDict
diff --git a/3rdParty/SCons/scons-local/SCons/Node/FS.py b/3rdParty/SCons/scons-local/SCons/Node/FS.py
index abcd8da..6a435b4 100644
--- a/3rdParty/SCons/scons-local/SCons/Node/FS.py
+++ b/3rdParty/SCons/scons-local/SCons/Node/FS.py
@@ -11,7 +11,7 @@ that can be used by scripts or modules looking for the canonical default.
"""
#
-# 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
@@ -33,7 +33,7 @@ that can be used by scripts or modules looking for the canonical default.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Node/FS.py 4043 2009/02/23 09:06:45 scons"
+__revision__ = "src/engine/SCons/Node/FS.py 4761 2010/04/04 14:04:44 bdeegan"
from itertools import izip
import cStringIO
@@ -58,12 +58,46 @@ else:
except AttributeError:
codecs.BOM_UTF8 = '\xef\xbb\xbf'
try:
- codecs.BOM_UTF16
+ codecs.BOM_UTF16_LE
+ codecs.BOM_UTF16_BE
except AttributeError:
- if sys.byteorder == 'little':
- codecs.BOM_UTF16 = '\xff\xfe'
+ codecs.BOM_UTF16_LE = '\xff\xfe'
+ codecs.BOM_UTF16_BE = '\xfe\xff'
+
+ # Provide a wrapper function to handle decoding differences in
+ # different versions of Python. Normally, we'd try to do this in the
+ # compat layer (and maybe it still makes sense to move there?) but
+ # that doesn't provide a way to supply the string class used in
+ # pre-2.3 Python versions with a .decode() method that all strings
+ # naturally have. Plus, the 2.[01] encodings behave differently
+ # enough that we have to settle for a lowest-common-denominator
+ # wrapper approach.
+ #
+ # Note that the 2.[012] implementations below may be inefficient
+ # because they perform an explicit look up of the encoding for every
+ # decode, but they're old enough (and we want to stop supporting
+ # them soon enough) that it's not worth complicating the interface.
+ # Think of it as additional incentive for people to upgrade...
+ try:
+ ''.decode
+ except AttributeError:
+ # 2.0 through 2.2: strings have no .decode() method
+ try:
+ codecs.lookup('ascii').decode
+ except AttributeError:
+ # 2.0 and 2.1: encodings are a tuple of functions, and the
+ # decode() function returns a (result, length) tuple.
+ def my_decode(contents, encoding):
+ return codecs.lookup(encoding)[1](contents)[0]
else:
- codecs.BOM_UTF16 = '\xfe\xff'
+ # 2.2: encodings are an object with methods, and the
+ # .decode() method returns just the decoded bytes.
+ def my_decode(contents, encoding):
+ return codecs.lookup(encoding).decode(contents)
+ else:
+ # 2.3 or later: use the .decode() string method
+ def my_decode(contents, encoding):
+ return contents.decode(encoding)
import SCons.Action
from SCons.Debug import logInstanceCreation
@@ -554,22 +588,22 @@ class Base(SCons.Node.Node):
# Filenames and paths are probably reused and are intern'ed to
# save some memory.
- self.name = intern(name)
- self.suffix = intern(SCons.Util.splitext(name)[1])
+ self.name = SCons.Util.silent_intern(name)
+ self.suffix = SCons.Util.silent_intern(SCons.Util.splitext(name)[1])
self.fs = fs
assert directory, "A directory must be provided"
- self.abspath = intern(directory.entry_abspath(name))
- self.labspath = intern(directory.entry_labspath(name))
+ self.abspath = SCons.Util.silent_intern(directory.entry_abspath(name))
+ self.labspath = SCons.Util.silent_intern(directory.entry_labspath(name))
if directory.path == '.':
- self.path = intern(name)
+ self.path = SCons.Util.silent_intern(name)
else:
- self.path = intern(directory.entry_path(name))
+ self.path = SCons.Util.silent_intern(directory.entry_path(name))
if directory.tpath == '.':
- self.tpath = intern(name)
+ self.tpath = SCons.Util.silent_intern(name)
else:
- self.tpath = intern(directory.entry_tpath(name))
+ self.tpath = SCons.Util.silent_intern(directory.entry_tpath(name))
self.path_elements = directory.path_elements + [self]
self.dir = directory
@@ -1749,7 +1783,7 @@ class Dir(Base):
d[name] = result
return result
else:
- return d.has_key(name)
+ return d.has_key(_my_normcase(name))
memoizer_counters.append(SCons.Memoize.CountValue('srcdir_list'))
@@ -1919,7 +1953,9 @@ class Dir(Base):
"""
dirname, basename = os.path.split(pathname)
if not dirname:
- return self._glob1(basename, ondisk, source, strings)
+ result = self._glob1(basename, ondisk, source, strings)
+ result.sort(lambda a, b: cmp(str(a), str(b)))
+ return result
if has_glob_magic(dirname):
list = self.glob(dirname, ondisk, source, strings=False)
else:
@@ -2074,7 +2110,8 @@ class RootDir(Dir):
result = self._lookupDict[k]
except KeyError:
if not create:
- raise SCons.Errors.UserError
+ msg = "No such file or directory: '%s' in '%s' (and create is False)" % (p, str(self))
+ raise SCons.Errors.UserError, msg
# There is no Node for this path name, and we're allowed
# to create it.
dir_name, file_name = os.path.split(p)
@@ -2309,10 +2346,27 @@ class File(Base):
# it's a valid python string.
def get_text_contents(self):
contents = self.get_contents()
+ # The behavior of various decode() methods and functions
+ # w.r.t. the initial BOM bytes is different for different
+ # encodings and/or Python versions. ('utf-8' does not strip
+ # them, but has a 'utf-8-sig' which does; 'utf-16' seems to
+ # strip them; etc.) Just side step all the complication by
+ # explicitly stripping the BOM before we decode().
if contents.startswith(codecs.BOM_UTF8):
- contents = contents.decode('utf-8')
- elif contents.startswith(codecs.BOM_UTF16):
- contents = contents.decode('utf-16')
+ contents = contents[len(codecs.BOM_UTF8):]
+ # TODO(2.2): Remove when 2.3 becomes floor.
+ #contents = contents.decode('utf-8')
+ contents = my_decode(contents, 'utf-8')
+ elif contents.startswith(codecs.BOM_UTF16_LE):
+ contents = contents[len(codecs.BOM_UTF16_LE):]
+ # TODO(2.2): Remove when 2.3 becomes floor.
+ #contents = contents.decode('utf-16-le')
+ contents = my_decode(contents, 'utf-16-le')
+ elif contents.startswith(codecs.BOM_UTF16_BE):
+ contents = contents[len(codecs.BOM_UTF16_BE):]
+ # TODO(2.2): Remove when 2.3 becomes floor.
+ #contents = contents.decode('utf-16-be')
+ contents = my_decode(contents, 'utf-16-be')
return contents
def get_content_hash(self):
diff --git a/3rdParty/SCons/scons-local/SCons/Node/Python.py b/3rdParty/SCons/scons-local/SCons/Node/Python.py
index 9a22f42..c7188e2 100644
--- a/3rdParty/SCons/scons-local/SCons/Node/Python.py
+++ b/3rdParty/SCons/scons-local/SCons/Node/Python.py
@@ -5,7 +5,7 @@ Python nodes.
"""
#
-# 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 @@ Python nodes.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Node/Python.py 4043 2009/02/23 09:06:45 scons"
+__revision__ = "src/engine/SCons/Node/Python.py 4761 2010/04/04 14:04:44 bdeegan"
import SCons.Node
@@ -53,7 +53,7 @@ class Value(SCons.Node.Node):
def __init__(self, value, built_value=None):
SCons.Node.Node.__init__(self)
self.value = value
- if not built_value is None:
+ if built_value is not None:
self.built_value = built_value
def str_for_display(self):
@@ -88,17 +88,20 @@ class Value(SCons.Node.Node):
self.built_value = self.value
return self.built_value
- def get_contents(self):
+ def get_text_contents(self):
"""By the assumption that the node.built_value is a
deterministic product of the sources, the contents of a Value
are the concatenation of all the contents of its sources. As
the value need not be built when get_contents() is called, we
cannot use the actual node.built_value."""
+ ###TODO: something reasonable about universal newlines
contents = str(self.value)
for kid in self.children(None):
contents = contents + kid.get_contents()
return contents
+ get_contents = get_text_contents ###TODO should return 'bytes' value
+
def changed_since_last_build(self, target, prev_ni):
cur_csig = self.get_csig()
try:
diff --git a/3rdParty/SCons/scons-local/SCons/Node/__init__.py b/3rdParty/SCons/scons-local/SCons/Node/__init__.py
index abb746e..f2ed2f0 100644
--- a/3rdParty/SCons/scons-local/SCons/Node/__init__.py
+++ b/3rdParty/SCons/scons-local/SCons/Node/__init__.py
@@ -20,7 +20,7 @@ be able to depend on any other type of "thing."
"""
#
-# 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
@@ -42,7 +42,7 @@ be able to depend on any other type of "thing."
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
-__revision__ = "src/engine/SCons/Node/__init__.py 4043 2009/02/23 09:06:45 scons"
+__revision__ = "src/engine/SCons/Node/__init__.py 4761 2010/04/04 14:04:44 bdeegan"
import copy
from itertools import chain, izip
@@ -352,7 +352,7 @@ class Node:
if d.missing():
msg = "Explicit dependency `%s' not found, needed by target `%s'."
raise SCons.Errors.StopError, msg % (d, self)
- if not self.implicit is None:
+ if self.implicit is not None:
for i in self.implicit:
if i.missing():
msg = "Implicit dependency `%s' not found, needed by target `%s'."
@@ -474,7 +474,7 @@ class Node:
# There was no explicit builder for this Node, so initialize
# the self.builder attribute to None now.
b = self.builder = None
- return not b is None
+ return b is not None
def set_explicit(self, is_explicit):
self.is_explicit = is_explicit
@@ -602,7 +602,7 @@ class Node:
# Don't bother scanning non-derived files, because we don't
# care what their dependencies are.
# Don't scan again, if we already have scanned.
- if not self.implicit is None:
+ if self.implicit is not None:
return
self.implicit = []
self.implicit_set = set()
@@ -891,7 +891,7 @@ class Node:
def add_wkid(self, wkid):
"""Add a node to the list of kids waiting to be evaluated"""
- if self.wkids != None:
+ if self.wkids is not None:
self.wkids.append(wkid)
def _children_reset(self):