diff options
author | William Deegan <bill@baddogconsulting.com> | 2017-04-15 18:48:49 (GMT) |
---|---|---|
committer | William Deegan <bill@baddogconsulting.com> | 2017-04-15 18:48:49 (GMT) |
commit | 54b73e170a60275b7b343b0a89b439ae86bb63c4 (patch) | |
tree | a7cee63236d0ec8ed7210781b655265b1628d470 /src | |
parent | c6281db8311345dbae895a498bd44b73600d4c0c (diff) | |
parent | 4e4854aabb4f3283972737440aa64dd221e7aeee (diff) | |
download | SCons-54b73e170a60275b7b343b0a89b439ae86bb63c4.zip SCons-54b73e170a60275b7b343b0a89b439ae86bb63c4.tar.gz SCons-54b73e170a60275b7b343b0a89b439ae86bb63c4.tar.bz2 |
Merged in gauravjuvekar/scons (pull request #427)
string-escape unicode characters while printing --tree
Diffstat (limited to 'src')
-rw-r--r-- | src/CHANGES.txt | 4 | ||||
-rw-r--r-- | src/engine/SCons/Util.py | 18 |
2 files changed, 19 insertions, 3 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt index cb6ab21..5127c51 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -13,6 +13,10 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER RELEASE VERSION/DATE TO BE FILLED IN LATER + From Gaurav Juvekar: + - Fix issue #2910: Make --tree=all handle Unicode. (PR #427) + - Fix issue #2788: Fix typo in documentation example for sconf. (PR #388) + From Manish Vachharajani: - Update debian rules, compat, and control to not use features deprecated or obsolete in later versions of debhelpers diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index a8a6990..2d8e75a 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -31,6 +31,7 @@ import sys import copy import re import types +import codecs try: from UserDict import UserDict @@ -148,7 +149,7 @@ class NodeList(UserList): # else: # self.data = [ initlist,] - + def __nonzero__(self): return len(self.data) != 0 @@ -170,10 +171,10 @@ class NodeList(UserList): return self.__class__(result) def __getitem__(self, index): - """ + """ This comes for free on py2, but py3 slices of NodeList are returning a list - breaking slicing nodelist and refering to + breaking slicing nodelist and refering to properties and methods on contained object """ # return self.__class__(self.data[index]) @@ -289,6 +290,17 @@ 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 + 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') + rname = codecs.escape_encode(rname)[0] + # Finally, we need a string again. + rname = rname.decode('ascii') # Initialize 'visited' dict, if required if visited is None: |