From 36b38cccb12248c106575753a8f2807bfd88c2fa Mon Sep 17 00:00:00 2001 From: William Deegan Date: Sun, 8 May 2016 20:58:39 -0700 Subject: py2/3 compatibility changes. --- src/engine/SCons/Util.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 5b11f83..a5a92fa 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -32,13 +32,27 @@ import copy import re import types -from UserDict import UserDict -from UserList import UserList -from UserString import UserString +try: + from UserDict import UserDict +except ImportError as e: + from collections import UserDict + +try: + from UserList import UserList +except ImportError as e: + from collections import UserList + +try: + from UserString import UserString +except ImportError as e: + from collections import UserString # Don't "from types import ..." these because we need to get at the # types module later to look for UnicodeType. -InstanceType = types.InstanceType + +# Below not used? +# InstanceType = types.InstanceType + MethodType = types.MethodType FunctionType = types.FunctionType try: unicode -- cgit v0.12