summaryrefslogtreecommitdiffstats
path: root/src/engine
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2010-04-13 07:42:22 (GMT)
committerSteven Knight <knight@baldmt.com>2010-04-13 07:42:22 (GMT)
commitdc59551fed874322b91be8a4fb6f3b880cf7d40b (patch)
treeb006e53237b81b8b3904bc9afaf84c4d68f75d08 /src/engine
parentc74d83bbf1422d3eac32ffa12bf0bbc1d73461df (diff)
downloadSCons-dc59551fed874322b91be8a4fb6f3b880cf7d40b.zip
SCons-dc59551fed874322b91be8a4fb6f3b880cf7d40b.tar.gz
SCons-dc59551fed874322b91be8a4fb6f3b880cf7d40b.tar.bz2
Avoid 3.0 fixer issues by not using module names as variable names.
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/SCons/compat/__init__.py41
-rw-r--r--src/engine/SCons/compat/_scons_collections.py17
-rw-r--r--src/engine/SCons/compat/_scons_io.py7
-rw-r--r--src/engine/SCons/compat/_scons_shlex.py11
4 files changed, 51 insertions, 25 deletions
diff --git a/src/engine/SCons/compat/__init__.py b/src/engine/SCons/compat/__init__.py
index 2cec73d..67d47ee 100644
--- a/src/engine/SCons/compat/__init__.py
+++ b/src/engine/SCons/compat/__init__.py
@@ -80,10 +80,10 @@ except ImportError:
# Use the "imp" module to protect the import from fixers.
import imp
import sys
- __builtin__ = imp.load_module('__builtin__',
- *imp.find_module('__builtin__'))
- sys.modules['builtins'] = __builtin__
- del __builtin__
+ _builtin = imp.load_module('__builtin__',
+ *imp.find_module('__builtin__'))
+ sys.modules['builtins'] = _builtin
+ del _builtin
import _scons_builtins
@@ -116,24 +116,27 @@ except ImportError:
# Pre-2.4 Python has no collections module.
import_as('_scons_collections', 'collections')
else:
+ # Use the "imp" module to protect the imports below from fixers.
+ import imp
try:
collections.UserDict
except AttributeError:
- import UserDict
- collections.UserDict = UserDict.UserDict
- del UserDict
+ _UserDict = imp.load_module('UserDict', *imp.find_module('UserDict'))
+ collections.UserDict = _UserDict.UserDict
+ del _UserDict
try:
collections.UserList
except AttributeError:
- import UserList
- collections.UserList = UserList.UserList
- del UserList
+ _UserList = imp.load_module('UserList', *imp.find_module('UserList'))
+ collections.UserList = _UserList.UserList
+ del _UserList
try:
collections.UserString
except AttributeError:
- import UserString
- collections.UserString = UserString.UserString
- del UserString
+ _UserString = imp.load_module('UserString',
+ *imp.find_module('UserString'))
+ collections.UserString = _UserString.UserString
+ del _UserString
import fnmatch
@@ -214,29 +217,29 @@ except AttributeError:
try:
# Use the "imp" module to protect the import from fixers.
import imp
- cPickle = imp.load_module('cPickle', *imp.find_module('cPickle'))
+ _cPickle = imp.load_module('cPickle', *imp.find_module('cPickle'))
except ImportError, e:
# The "cPickle" module has already been eliminated in favor of
# having "import pickle" import the fast version when available.
pass
else:
import sys
- sys.modules['pickle'] = cPickle
- del cPickle
+ sys.modules['pickle'] = _cPickle
+ del _cPickle
try:
# Use the "imp" module to protect the import from fixers.
import imp
- cProfile = imp.load_module('cProfile', *imp.find_module('cProfile'))
+ _cProfile = imp.load_module('cProfile', *imp.find_module('cProfile'))
except ImportError:
# The "cProfile" module has already been eliminated in favor of
# having "import profile" import the fast version when available.
pass
else:
import sys
- sys.modules['profile'] = cProfile
- del cProfile
+ sys.modules['profile'] = _cProfile
+ del _cProfile
try:
diff --git a/src/engine/SCons/compat/_scons_collections.py b/src/engine/SCons/compat/_scons_collections.py
index 80832b7..089f0aa 100644
--- a/src/engine/SCons/compat/_scons_collections.py
+++ b/src/engine/SCons/compat/_scons_collections.py
@@ -32,9 +32,20 @@ our purposes.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-from UserDict import UserDict
-from UserList import UserList
-from UserString import UserString
+# Use the "imp" module to protect the imports below from fixers.
+import imp
+
+_UserDict = imp.load_module('UserDict', *imp.find_module('UserDict'))
+_UserList = imp.load_module('UserList', *imp.find_module('UserList'))
+_UserString = imp.load_module('UserString', *imp.find_module('UserString'))
+
+UserDict = _UserDict.UserDict
+UserList = _UserList.UserList
+UserString = _UserString.UserString
+
+del _UserDict
+del _UserList
+del _UserString
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/compat/_scons_io.py b/src/engine/SCons/compat/_scons_io.py
index 784021d..538afb7 100644
--- a/src/engine/SCons/compat/_scons_io.py
+++ b/src/engine/SCons/compat/_scons_io.py
@@ -31,7 +31,12 @@ by SCons, in an interface that looks enough like io for our purposes.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-from cStringIO import StringIO
+# Use the "imp" module to protect the imports below from fixers.
+import imp
+
+_cStringIO = imp.load_module('cStringIO', *imp.find_module('cStringIO'))
+StringIO = _cStringIO.StringIO
+del _cStringIO
# Local Variables:
# tab-width:4
diff --git a/src/engine/SCons/compat/_scons_shlex.py b/src/engine/SCons/compat/_scons_shlex.py
index febaa99..dfca2c1 100644
--- a/src/engine/SCons/compat/_scons_shlex.py
+++ b/src/engine/SCons/compat/_scons_shlex.py
@@ -7,6 +7,7 @@
# Posix compliance, split(), string arguments, and
# iterator interface by Gustavo Niemeyer, April 2003.
+import imp
import os.path
import sys
#from collections import deque
@@ -31,10 +32,16 @@ else:
def is_basestring(s):
return isinstance(s, basestring)
+# Use the "imp" module to protect the imports below from fixers.
try:
- from cStringIO import StringIO
+ _cStringIO = imp.load_module('cStringIO', *imp.find_module('cStringIO'))
except ImportError:
- from StringIO import StringIO
+ _StringIO = imp.load_module('StringIO', *imp.find_module('StringIO'))
+ StringIO = _StringIO.StringIO
+ del _StringIO
+else:
+ StringIO = _cStringIO.StringIO
+ del _cStringIO
__all__ = ["shlex", "split"]