diff options
author | Stefan Zimmermann <zimmermann.code@gmail.com> | 2014-01-08 13:25:16 (GMT) |
---|---|---|
committer | Stefan Zimmermann <zimmermann.code@gmail.com> | 2014-01-08 13:25:16 (GMT) |
commit | 26003a0bd3168f8c2ee3d92a26d35ca977f8e25b (patch) | |
tree | 5f61654ad672dbaaef043c67f2d5b74254e2abca /src/engine | |
parent | 59ee07b24ed1278d83aa70605f51b6284aa60a82 (diff) | |
download | SCons-26003a0bd3168f8c2ee3d92a26d35ca977f8e25b.zip SCons-26003a0bd3168f8c2ee3d92a26d35ca977f8e25b.tar.gz SCons-26003a0bd3168f8c2ee3d92a26d35ca977f8e25b.tar.bz2 |
Some more six.PY2/PY3 usage.
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/Util.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 7ea2789..052b3fc 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -33,24 +33,21 @@ import copy import re import types -try: +if PY3: from collections import UserDict, UserList, UserString -except ImportError: # Python < 3 +else: from UserDict import UserDict from UserList import UserList from UserString import UserString # Don't "from types import ..." these because we need to get at the # types module later to look for UnicodeType. -try: - InstanceType = types.InstanceType -except AttributeError: # Python 3 - InstanceType = None +InstanceType = types.InstanceType if PY2 else None MethodType = types.MethodType FunctionType = types.FunctionType try: unicode except NameError: UnicodeType = None -else: UnicodeType = str +else: UnicodeType = unicode def dictify(keys, values, result={}): for k, v in zip(keys, values): |