summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-02-22 13:17:05 (GMT)
committerSteven Knight <knight@baldmt.com>2003-02-22 13:17:05 (GMT)
commit531efcbc25f41d61c805133b1510baf29570d985 (patch)
treeb4182d457542bbdd49b18407bb4652d47ab9dd25 /src
parentdbe12389b6253c305749d8e2d4e1558477a15787 (diff)
downloadSCons-531efcbc25f41d61c805133b1510baf29570d985.zip
SCons-531efcbc25f41d61c805133b1510baf29570d985.tar.gz
SCons-531efcbc25f41d61c805133b1510baf29570d985.tar.bz2
Make SCons.Util.to_String() more efficient.
Diffstat (limited to 'src')
-rw-r--r--src/CHANGES.txt2
-rw-r--r--src/engine/SCons/Util.py21
2 files changed, 14 insertions, 9 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index dce8e34..9fa0501 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -23,6 +23,8 @@ RELEASE 0.12 - XXX
from source code systems. Add factory methods that create Builders
to support BitKeeper, CVS, RCS, SCCS and Subversion.
+ - Make the internal to_String() function more efficient.
+
RELEASE 0.11 - Tue, 11 Feb 2003 05:24:33 -0600
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)