summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/compat
diff options
context:
space:
mode:
authorGreg Noel <GregNoel@tigris.org>2010-06-07 01:03:58 (GMT)
committerGreg Noel <GregNoel@tigris.org>2010-06-07 01:03:58 (GMT)
commit4342bb15a6592e9a29716523902d717aaa841ccc (patch)
tree18ab3ca340a61eae1a313c1f6c6ab91ecde56412 /src/engine/SCons/compat
parenta50e413e5dd97a4bb014fcdfdec6050f03de699c (diff)
downloadSCons-4342bb15a6592e9a29716523902d717aaa841ccc.zip
SCons-4342bb15a6592e9a29716523902d717aaa841ccc.tar.gz
SCons-4342bb15a6592e9a29716523902d717aaa841ccc.tar.bz2
For some reason, using the `imp` module to do imports doesn't do quite the
same thing as using the 'import' statement, even though the documentation clearly says that the 'import' statement uses the 'imp' module under the covers. I have no clue why, but there were some cases where it made a difference. The code was changed to using 'imp' to prevent the fixers from trying to convert the old names to the new names, so this changeset uses a different technique to hide the old names.
Diffstat (limited to 'src/engine/SCons/compat')
-rw-r--r--src/engine/SCons/compat/__init__.py13
-rw-r--r--src/engine/SCons/compat/_scons_collections.py19
2 files changed, 11 insertions, 21 deletions
diff --git a/src/engine/SCons/compat/__init__.py b/src/engine/SCons/compat/__init__.py
index bfa8384..c870fbc 100644
--- a/src/engine/SCons/compat/__init__.py
+++ b/src/engine/SCons/compat/__init__.py
@@ -121,21 +121,20 @@ else:
try:
collections.UserDict
except AttributeError:
- _UserDict = imp.load_module('UserDict', *imp.find_module('UserDict'))
- collections.UserDict = _UserDict.UserDict
+ exec('from UserDict import UserDict as _UserDict')
+ collections.UserDict = _UserDict
del _UserDict
try:
collections.UserList
except AttributeError:
- _UserList = imp.load_module('UserList', *imp.find_module('UserList'))
- collections.UserList = _UserList.UserList
+ exec('from UserList import UserList as _UserList')
+ collections.UserList = _UserList
del _UserList
try:
collections.UserString
except AttributeError:
- _UserString = imp.load_module('UserString',
- *imp.find_module('UserString'))
- collections.UserString = _UserString.UserString
+ exec('from UserString import UserString as _UserString')
+ collections.UserString = _UserString
del _UserString
diff --git a/src/engine/SCons/compat/_scons_collections.py b/src/engine/SCons/compat/_scons_collections.py
index 089f0aa..1591b2e 100644
--- a/src/engine/SCons/compat/_scons_collections.py
+++ b/src/engine/SCons/compat/_scons_collections.py
@@ -32,20 +32,11 @@ our purposes.
__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-# 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
+# Use exec to hide old names from fixers.
+exec("""if True:
+ from UserDict import UserDict
+ from UserList import UserList
+ from UserString import UserString""")
# Local Variables:
# tab-width:4