diff options
author | Steven Knight <knight@baldmt.com> | 2010-04-07 13:16:57 +0000 |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2010-04-07 13:16:57 +0000 |
commit | e484c24f3ea5168bb420a715913da1bca156a0a2 (patch) | |
tree | 4d16f888d6f0de67d3dba1341b768df17d852b44 /src/engine/SCons/Util.py | |
parent | 52b2b87b8666da930b061c37efafe6a90c106627 (diff) | |
download | scons-e484c24f3ea5168bb420a715913da1bca156a0a2.tar.gz |
Issue 2332: Convert from using StringIO.StringIO class to using the
forward-compatible io.StringIO class, with the addition of an "io"
compatibility module for Python versions before 2.6.
Diffstat (limited to 'src/engine/SCons/Util.py')
-rw-r--r-- | src/engine/SCons/Util.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 8aa5f238..4ada2736 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -161,7 +161,7 @@ class DisplayEngine: def print_it(self, text, append_newline=1): if append_newline: text = text + '\n' try: - sys.stdout.write(text) + sys.stdout.write(unicode(text)) except IOError: # Stdout might be connected to a pipe that has been closed # by now. The most likely reason for the pipe being closed @@ -242,17 +242,18 @@ def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited={}): if showtags: if showtags == 2: - print ' E = exists' - print ' R = exists in repository only' - print ' b = implicit builder' - print ' B = explicit builder' - print ' S = side effect' - print ' P = precious' - print ' A = always build' - print ' C = current' - print ' N = no clean' - print ' H = no cache' - print '' + legend = (' E = exists\n' + + ' R = exists in repository only\n' + + ' b = implicit builder\n' + + ' B = explicit builder\n' + + ' S = side effect\n' + + ' P = precious\n' + + ' A = always build\n' + + ' C = current\n' + + ' N = no clean\n' + + ' H = no cache\n' + + '\n') + sys.stdout.write(unicode(legend)) tags = ['['] tags.append(' E'[IDX(root.exists())]) @@ -277,10 +278,10 @@ def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited={}): children = child_func(root) if prune and rname in visited and children: - print ''.join(tags + margins + ['+-[', rname, ']']) + sys.stdout.write(''.join(tags + margins + ['+-[', rname, ']']) + u'\n') return - print ''.join(tags + margins + ['+-', rname]) + sys.stdout.write(''.join(tags + margins + ['+-', rname]) + u'\n') visited[rname] = 1 |