diff options
author | Gaurav Juvekar <gauravjuvekar@gmail.com> | 2017-05-09 19:14:08 (GMT) |
---|---|---|
committer | Gaurav Juvekar <gauravjuvekar@gmail.com> | 2017-05-09 19:14:08 (GMT) |
commit | 166cd52fd4c2f8ca32966b7669e9caf0ede05a5d (patch) | |
tree | 70493e66c180a2ddd20a224ab71102e1e04dc874 /src/engine | |
parent | 2a2f26cd83da8e63ead93999e7a08502f222ffd8 (diff) | |
download | SCons-166cd52fd4c2f8ca32966b7669e9caf0ede05a5d.zip SCons-166cd52fd4c2f8ca32966b7669e9caf0ede05a5d.tar.gz SCons-166cd52fd4c2f8ca32966b7669e9caf0ede05a5d.tar.bz2 |
Directly print unicode in --tree
Diffstat (limited to 'src/engine')
-rw-r--r-- | src/engine/SCons/Util.py | 23 |
1 files changed, 2 insertions, 21 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index a927c6d..dcfe823 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -290,25 +290,6 @@ def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited=None): """ rname = str(root) - if sys.version_info.major < 3: - # Python 2 UTF-8 encoded str are str. escape_encode is a str to str - # encoding - try: - rname.decode('ascii') - except UnicodeDecodeError: - # If we can't decode into ascii, then escape it - rname = codecs.escape_encode(rname)[0] - else: - # Python 3 UTF-8 encoded str are bytes. escape_encode is a byte to byte - # encoding here. - rname = rname.encode('utf-8') - try: - # Finally, we need a string again. - rname = rname.decode('ascii') - except UnicodeDecodeError: - # If we can't decode into ascii, then escape it - rname = codecs.escape_encode(rname)[0] - rname = rname.decode('ascii') # Initialize 'visited' dict, if required @@ -354,10 +335,10 @@ def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited=None): children = child_func(root) if prune and rname in visited and children: - sys.stdout.write(''.join(tags + margins + ['+-[', rname, ']']) + u'\n') + sys.stdout.write(''.join(tags + margins + ['+-[', rname, ']']) + '\n') return - sys.stdout.write(''.join(tags + margins + ['+-', rname]) + u'\n') + sys.stdout.write(''.join(tags + margins + ['+-', rname]) + '\n') visited[rname] = 1 |