diff options
author | Mats Wichmann <mats@linux.com> | 2020-03-24 20:14:00 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2020-03-24 20:14:00 (GMT) |
commit | 52e08116a2a391deb706ca6eb9b47302e93f852b (patch) | |
tree | c8c0bbc95103283378439ea126ea31a5e8180f2a /src | |
parent | 1d6761d2c25ba0471b7d9141c9495de2e6ba31c1 (diff) | |
download | SCons-52e08116a2a391deb706ca6eb9b47302e93f852b.zip SCons-52e08116a2a391deb706ca6eb9b47302e93f852b.tar.gz SCons-52e08116a2a391deb706ca6eb9b47302e93f852b.tar.bz2 |
[PR #3591] tweak --tree=linedraw
Add version note to manpage
Turn linedraw chars into module-level constants, and
use in the other place it was hardcoded.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/engine/SCons/Util.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 767b3f9..588d02f 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -253,6 +253,16 @@ def render_tree(root, child_func, prune=0, margin=[0], visited=None): IDX = lambda N: N and 1 or 0 +# unicode line drawing chars: +BOX_HORIZ = chr(0x2500) # '─' +BOX_VERT = chr(0x2502) # '│' +BOX_UP_RIGHT = chr(0x2514) # '└' +BOX_DOWN_RIGHT = chr(0x250c) # '┌' +BOX_DOWN_LEFT = chr(0x2510) # '┐' +BOX_UP_LEFT = chr(0x2518) # '┘' +BOX_VERT_RIGHT = chr(0x251c) # '├' +BOX_HORIZ_DOWN = chr(0x252c) # '┬' + def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited=None, lastChild=False, singleLineDraw=False): """ @@ -315,9 +325,9 @@ def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited=None, def MMM(m): if singleLineDraw: - return [" ","│ "][m] + return [" ", BOX_VERT + " "][m] else: - return [" ","| "][m] + return [" ", "| "][m] margins = list(map(MMM, margin[:-1])) @@ -326,29 +336,19 @@ def print_tree(root, child_func, prune=0, showtags=0, margin=[0], visited=None, cross = "+-" if singleLineDraw: - # unicode line drawing chars: - box_horiz = chr(0x2500) # '─' - box_vert = chr(0x2510) # '│' - box_up_right = chr(0x2514) # '└' - box_down_right = chr(0x250c) # '┌' - box_down_left = chr(0x2510) # '┐' - box_up_left = chr(0x2518) # '┘' - box_vert_right = chr(0x251c) # '├' - box_horiz_down = chr(0x252c) # '┬' - - cross = box_vert_right + box_horiz # sign used to point to the leaf. + cross = BOX_VERT_RIGHT + BOX_HORIZ # sign used to point to the leaf. # check if this is the last leaf of the branch if lastChild: #if this if the last leaf, then terminate: - cross = box_up_right + box_horiz # sign for the last leaf + cross = BOX_UP_RIGHT + BOX_HORIZ # sign for the last leaf # if this branch has children then split it if children: # if it's a leaf: if prune and rname in visited and children: - cross += box_horiz + cross += BOX_HORIZ else: - cross += box_horiz_down + cross += BOX_HORIZ_DOWN if prune and rname in visited and children: sys.stdout.write(''.join(tags + margins + [cross,'[', rname, ']']) + '\n') |