summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2010-04-11 14:09:56 (GMT)
committerSteven Knight <knight@baldmt.com>2010-04-11 14:09:56 (GMT)
commit87458be9755919b6d21ec395001f916db81ec5c5 (patch)
treeb7ff90f5da7dba44dab3fe62f91a67399df2cfd1 /src/engine
parent766675b428700a8f73e92f7e3de6d8d456fc2b99 (diff)
downloadSCons-87458be9755919b6d21ec395001f916db81ec5c5.zip
SCons-87458be9755919b6d21ec395001f916db81ec5c5.tar.gz
SCons-87458be9755919b6d21ec395001f916db81ec5c5.tar.bz2
Add compat "collections" module for pre-2.4 Python verseions. For now.
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/MANIFEST.in1
-rw-r--r--src/engine/SCons/Node/NodeTests.py2
-rw-r--r--src/engine/SCons/Platform/PlatformTests.py2
-rw-r--r--src/engine/SCons/Scanner/CTests.py2
-rw-r--r--src/engine/SCons/Scanner/LaTeXTests.py2
-rw-r--r--src/engine/SCons/Scanner/ScannerTests.py2
-rw-r--r--src/engine/SCons/compat/__init__.py41
-rw-r--r--src/engine/SCons/compat/_scons_collections.py43
8 files changed, 77 insertions, 18 deletions
diff --git a/src/engine/MANIFEST.in b/src/engine/MANIFEST.in
index ec5e32c..576c82c 100644
--- a/src/engine/MANIFEST.in
+++ b/src/engine/MANIFEST.in
@@ -2,6 +2,7 @@ SCons/__init__.py
SCons/Action.py
SCons/Builder.py
SCons/compat/__init__.py
+SCons/compat/_scons_collections.py
SCons/compat/_scons_hashlib.py
SCons/compat/_scons_io.py
SCons/compat/_scons_itertools.py
diff --git a/src/engine/SCons/Node/NodeTests.py b/src/engine/SCons/Node/NodeTests.py
index 8c3dbe8..5f1b4b0 100644
--- a/src/engine/SCons/Node/NodeTests.py
+++ b/src/engine/SCons/Node/NodeTests.py
@@ -24,6 +24,8 @@ from __future__ import generators ### KEEP FOR COMPATIBILITY FIXERS
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import SCons.compat
+
import collections
import os
import re
diff --git a/src/engine/SCons/Platform/PlatformTests.py b/src/engine/SCons/Platform/PlatformTests.py
index 464dd02..6841272 100644
--- a/src/engine/SCons/Platform/PlatformTests.py
+++ b/src/engine/SCons/Platform/PlatformTests.py
@@ -23,6 +23,8 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import SCons.compat
+
import collections
import sys
import unittest
diff --git a/src/engine/SCons/Scanner/CTests.py b/src/engine/SCons/Scanner/CTests.py
index acbfe50..34e3163 100644
--- a/src/engine/SCons/Scanner/CTests.py
+++ b/src/engine/SCons/Scanner/CTests.py
@@ -23,6 +23,8 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import SCons.compat
+
import collections
import os
import sys
diff --git a/src/engine/SCons/Scanner/LaTeXTests.py b/src/engine/SCons/Scanner/LaTeXTests.py
index afc17cf..8cea63f 100644
--- a/src/engine/SCons/Scanner/LaTeXTests.py
+++ b/src/engine/SCons/Scanner/LaTeXTests.py
@@ -23,6 +23,8 @@
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import SCons.compat
+
import collections
import os
import sys
diff --git a/src/engine/SCons/Scanner/ScannerTests.py b/src/engine/SCons/Scanner/ScannerTests.py
index cec89f4..922c221 100644
--- a/src/engine/SCons/Scanner/ScannerTests.py
+++ b/src/engine/SCons/Scanner/ScannerTests.py
@@ -24,6 +24,8 @@ from __future__ import generators ### KEEP FOR COMPATIBILITY FIXERS
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+import SCons.compat
+
import collections
import sys
import unittest
diff --git a/src/engine/SCons/compat/__init__.py b/src/engine/SCons/compat/__init__.py
index f220c32..cc14b92 100644
--- a/src/engine/SCons/compat/__init__.py
+++ b/src/engine/SCons/compat/__init__.py
@@ -97,25 +97,30 @@ except NameError:
__builtin__.set = sets.Set
-import collections
try:
- collections.UserDict
-except AttributeError:
- import UserDict
- collections.UserDict = UserDict.UserDict
- del UserDict
-try:
- collections.UserList
-except AttributeError:
- import UserList
- collections.UserList = UserList.UserList
- del UserList
-try:
- collections.UserString
-except AttributeError:
- import UserString
- collections.UserString = UserString.UserString
- del UserString
+ import collections
+except ImportError:
+ # Pre-2.4 Python has no collections module.
+ import_as('_scons_collections', 'collections')
+else:
+ try:
+ collections.UserDict
+ except AttributeError:
+ import UserDict
+ collections.UserDict = UserDict.UserDict
+ del UserDict
+ try:
+ collections.UserList
+ except AttributeError:
+ import UserList
+ collections.UserList = UserList.UserList
+ del UserList
+ try:
+ collections.UserString
+ except AttributeError:
+ import UserString
+ collections.UserString = UserString.UserString
+ del UserString
import fnmatch
diff --git a/src/engine/SCons/compat/_scons_collections.py b/src/engine/SCons/compat/_scons_collections.py
new file mode 100644
index 0000000..80832b7
--- /dev/null
+++ b/src/engine/SCons/compat/_scons_collections.py
@@ -0,0 +1,43 @@
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__doc__ = """
+collections compatibility module for older (pre-2.4) Python versions
+
+This does not not NOT (repeat, *NOT*) provide complete collections
+functionality. It only wraps the portions of collections functionality
+used by SCons, in an interface that looks enough like collections for
+our purposes.
+"""
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+from UserDict import UserDict
+from UserList import UserList
+from UserString import UserString
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: