summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2016-09-30 20:54:12 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2016-09-30 20:54:12 (GMT)
commitcff6d51e2d64ab0a716c1321ea5afb1c99a12b52 (patch)
tree6b82a44c4bebd8481c51ed4169e42d3ab970305a
parent696af9192158271e5167e6227a5dfaa614a2fb06 (diff)
downloadSCons-cff6d51e2d64ab0a716c1321ea5afb1c99a12b52.zip
SCons-cff6d51e2d64ab0a716c1321ea5afb1c99a12b52.tar.gz
SCons-cff6d51e2d64ab0a716c1321ea5afb1c99a12b52.tar.bz2
PEP8 fixes.
-rw-r--r--src/engine/SCons/compat/__init__.py22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/engine/SCons/compat/__init__.py b/src/engine/SCons/compat/__init__.py
index c6c7214..477b67c 100644
--- a/src/engine/SCons/compat/__init__.py
+++ b/src/engine/SCons/compat/__init__.py
@@ -61,10 +61,11 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
import os
import sys
-import imp # Use the "imp" module to protect imports from fixers.
+import imp # Use the "imp" module to protect imports from fixers.
PYPY = hasattr(sys, 'pypy_translation_info')
+
def import_as(module, name):
"""
Imports the specified module (from our local directory) as the
@@ -73,6 +74,7 @@ def import_as(module, name):
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.
@@ -84,6 +86,7 @@ def rename_module(new, old):
except ImportError:
return False
+
# TODO: FIXME
# In 3.x, 'pickle' automatically loads the fast version if available.
rename_module('pickle', 'cPickle')
@@ -92,7 +95,8 @@ rename_module('pickle', 'cPickle')
# but incompatible with older Python versions. On Python 2.7 this is 2.
# Negative numbers choose the highest available protocol.
import pickle
-PICKLE_PROTOCOL=pickle.HIGHEST_PROTOCOL
+
+PICKLE_PROTOCOL = pickle.HIGHEST_PROTOCOL
# TODO: FIXME
# In 3.x, 'profile' automatically loads the fast version if available.
@@ -106,7 +110,6 @@ rename_module('queue', 'Queue')
# Before Python 3.0, the 'winreg' module was named '_winreg'
rename_module('winreg', '_winreg')
-
# Python 3 moved builtin intern() to sys package
# To make porting easier, make intern always live
# in sys package (for python 2.7.x)
@@ -117,28 +120,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
import collections
+
try:
collections.UserDict
except AttributeError:
- exec('from UserDict import UserDict as _UserDict')
+ exec ('from UserDict import UserDict as _UserDict')
collections.UserDict = _UserDict
del _UserDict
try:
collections.UserList
except AttributeError:
- exec('from UserList import UserList as _UserList')
+ exec ('from UserList import UserList as _UserList')
collections.UserList = _UserList
del _UserList
try:
collections.UserString
except AttributeError:
- exec('from UserString import UserString as _UserString')
+ exec ('from UserString import UserString as _UserString')
collections.UserString = _UserString
del _UserString
@@ -168,13 +171,16 @@ def with_metaclass(meta, *bases):
This has the advantage over six.with_metaclass of not introducing
dummy classes into the final MRO.
"""
+
class metaclass(meta):
__call__ = type.__call__
__init__ = type.__init__
+
def __new__(cls, name, this_bases, d):
if this_bases is None:
return type.__new__(cls, name, (), d)
return meta(name, bases, d)
+
return metaclass('temporary_class', None, {})
@@ -182,12 +188,12 @@ class NoSlotsPyPy(type):
"""
Workaround for PyPy not working well with __slots__ and __class__ assignment.
"""
+
def __new__(meta, name, bases, dct):
if PYPY and '__slots__' in dct:
dct.pop('__slots__')
return super(NoSlotsPyPy, meta).__new__(meta, name, bases, dct)
-
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil