diff options
Diffstat (limited to 'src/engine/SCons/Util.py')
-rw-r--r-- | src/engine/SCons/Util.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 0d64e03..fcadf48 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -506,15 +506,18 @@ def is_Dict(e): def is_List(e): return type(e) is types.ListType or isinstance(e, UserList.UserList) -def to_String(s): - """Better than str() because it will preserve a unicode - object without converting it to ASCII.""" - if hasattr(types, 'UnicodeType') and \ - (type(s) is types.UnicodeType or \ - (isinstance(s, UserString) and type(s.data) is types.UnicodeType)): - return unicode(s) - else: - return str(s) +if hasattr(types, 'UnicodeType'): + def to_String(s): + if isinstance(s, UserString): + t = type(s.data) + else: + t = type(s) + if t is types.UnicodeType: + return unicode(s) + else: + return str(s) +else: + to_String = str def argmunge(arg): return Split(arg) |