summaryrefslogtreecommitdiff
path: root/engine/SCons/compat
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2019-07-23 13:30:08 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2019-07-23 13:30:08 +0200
commit9c04223086bf606eaac6dc2848af80518210d823 (patch)
treee455703d75ac36f88d95cb712f5ea3bc4fc0d96e /engine/SCons/compat
parent19712e5025e3cf6a33fccd0738f04e018d55025f (diff)
New upstream version 3.1.0upstream/3.1.0
Diffstat (limited to 'engine/SCons/compat')
-rw-r--r--engine/SCons/compat/__init__.py27
-rw-r--r--engine/SCons/compat/_scons_dbm.py2
2 files changed, 10 insertions, 19 deletions
diff --git a/engine/SCons/compat/__init__.py b/engine/SCons/compat/__init__.py
index 7846577..dcbd8e8 100644
--- a/engine/SCons/compat/__init__.py
+++ b/engine/SCons/compat/__init__.py
@@ -57,31 +57,22 @@ function defined below loads the module as the "real" name (without the
rest of our code will find our pre-loaded compatibility module.
"""
-__revision__ = "src/engine/SCons/compat/__init__.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/engine/SCons/compat/__init__.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
import os
import sys
-import imp # Use the "imp" module to protect imports from fixers.
+import importlib
PYPY = hasattr(sys, 'pypy_translation_info')
-def import_as(module, name):
- """
- Imports the specified module (from our local directory) as the
- specified name, returning the loaded module object.
- """
- dir = os.path.split(__file__)[0]
- return imp.load_module(name, *imp.find_module(module, [dir]))
-
-
def rename_module(new, old):
"""
- Attempts to import the old module and load it under the new name.
+ Attempt to import the old module and load it under the new name.
Used for purely cosmetic name changes in Python 3.x.
"""
try:
- sys.modules[new] = imp.load_module(old, *imp.find_module(old))
+ sys.modules[new] = importlib.import_module(old)
return True
except ImportError:
return False
@@ -122,28 +113,28 @@ except AttributeError:
# intern into the sys package
sys.intern = intern
-# Preparing for 3.x. UserDict, UserList, UserString are in
-# collections for 3.x, but standalone in 2.7.x
+# UserDict, UserList, UserString are in # collections for 3.x,
+# but standalone in 2.7.x. Monkey-patch into collections for 2.7.
import collections
try:
collections.UserDict
except AttributeError:
- exec ('from UserDict import UserDict as _UserDict')
+ from UserDict import UserDict as _UserDict
collections.UserDict = _UserDict
del _UserDict
try:
collections.UserList
except AttributeError:
- exec ('from UserList import UserList as _UserList')
+ from UserList import UserList as _UserList
collections.UserList = _UserList
del _UserList
try:
collections.UserString
except AttributeError:
- exec ('from UserString import UserString as _UserString')
+ from UserString import UserString as _UserString
collections.UserString = _UserString
del _UserString
diff --git a/engine/SCons/compat/_scons_dbm.py b/engine/SCons/compat/_scons_dbm.py
index a57f105..ec5e261 100644
--- a/engine/SCons/compat/_scons_dbm.py
+++ b/engine/SCons/compat/_scons_dbm.py
@@ -30,7 +30,7 @@ that the whichdb.whichdb() implementstation in the various 2.X versions of
Python won't blow up even if dbm wasn't compiled in.
"""
-__revision__ = "src/engine/SCons/compat/_scons_dbm.py a56bbd8c09fb219ab8a9673330ffcd55279219d0 2019-03-26 23:16:31 bdeegan"
+__revision__ = "src/engine/SCons/compat/_scons_dbm.py e724ae812eb96f4858a132f5b8c769724744faf6 2019-07-21 00:04:47 bdeegan"
class error(Exception):
pass