From 6a63deeace54613c91004535bc3d593bb161430e Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Mon, 18 May 2015 16:56:04 +0300 Subject: Fix --tree=all print when build tree contains non-ascii Node representation (PR #235) --- src/CHANGES.txt | 2 ++ src/engine/SCons/Util.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index ef4e016..42108de 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -34,6 +34,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER - Show --config choices if no argument is specified (PR #202). - Fixed build crash when XML toolchain isn't installed, and activated compression for ZIP archives. + - Fixed --tree=all print when build tree contains non-ascii + Node representation (PR #235). From Alexandre Feblot: - Fix for VersionedSharedLibrary under 'sunos' platform. diff --git a/src/engine/SCons/Util.py b/src/engine/SCons/Util.py index 822d524..6dd64ec 100644 --- a/src/engine/SCons/Util.py +++ b/src/engine/SCons/Util.py @@ -264,10 +264,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: - 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 -- cgit v0.12 From cd88c2ae35ff11b6565dcb8c7b0a0c1985346f51 Mon Sep 17 00:00:00 2001 From: anatoly techtonik Date: Tue, 26 May 2015 18:50:30 +0300 Subject: Add test for UnicodeDecode failure --- test/option--tree.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/option--tree.py b/test/option--tree.py index a50433c..519ebe3 100644 --- a/test/option--tree.py +++ b/test/option--tree.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- # # __COPYRIGHT__ # @@ -51,6 +52,20 @@ scons: warning: The --debug=tree option is deprecated; please use --tree=all ins """, status = 0, match=TestSCons.match_re_dotall) + +# Check that printing nodes won't fail with +# UnicodeDecodeError: 'ascii' codec ... ordinal not in range(128) +# https://bitbucket.org/scons/scons/pull-request/235 + +test.write('SConstruct', """\ +# -*- coding: utf-8 -*- + +Entry('русский юникод') +""") + +test.run(arguments = '-Q --tree=all') + + test.pass_test() # Local Variables: -- cgit v0.12