summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/compat
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2010-04-07 13:16:57 (GMT)
committerSteven Knight <knight@baldmt.com>2010-04-07 13:16:57 (GMT)
commit32d7c315d62846ea8febadcbb2c60cf9e3382cbf (patch)
tree4d16f888d6f0de67d3dba1341b768df17d852b44 /src/engine/SCons/compat
parentd63f3f799b9e015d4a77e5874fa4cc0c4efc511f (diff)
downloadSCons-32d7c315d62846ea8febadcbb2c60cf9e3382cbf.zip
SCons-32d7c315d62846ea8febadcbb2c60cf9e3382cbf.tar.gz
SCons-32d7c315d62846ea8febadcbb2c60cf9e3382cbf.tar.bz2
Issue 2332: Convert from using StringIO.StringIO class to using the
forward-compatible io.StringIO class, with the addition of an "io" compatibility module for Python versions before 2.6.
Diffstat (limited to 'src/engine/SCons/compat')
-rw-r--r--src/engine/SCons/compat/__init__.py6
-rw-r--r--src/engine/SCons/compat/_scons_io.py40
2 files changed, 46 insertions, 0 deletions
diff --git a/src/engine/SCons/compat/__init__.py b/src/engine/SCons/compat/__init__.py
index 792b77a..0b70c5d 100644
--- a/src/engine/SCons/compat/__init__.py
+++ b/src/engine/SCons/compat/__init__.py
@@ -125,6 +125,12 @@ except AttributeError:
del filter
try:
+ import io
+except ImportError:
+ # Pre-2.6 Python has no io module.
+ import_as('_scons_io', 'io')
+
+try:
import itertools
except ImportError:
# Pre-2.3 Python has no itertools module.
diff --git a/src/engine/SCons/compat/_scons_io.py b/src/engine/SCons/compat/_scons_io.py
new file mode 100644
index 0000000..784021d
--- /dev/null
+++ b/src/engine/SCons/compat/_scons_io.py
@@ -0,0 +1,40 @@
+#
+# __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__ = """
+io compatibility module for older (pre-2.6) Python versions
+
+This does not not NOT (repeat, *NOT*) provide complete io
+functionality. It only wraps the portions of io functionality used
+by SCons, in an interface that looks enough like io for our purposes.
+"""
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+from cStringIO import StringIO
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: