From 7c74ee56fc5b9006d16148f5cc6ee3758507a38b Mon Sep 17 00:00:00 2001 From: William Deegan Date: Tue, 14 Nov 2017 15:28:34 -0500 Subject: Fix messaging when two environments are specified for same target to handle when the action cannot be decoded as UTF-8. This most likely only happens when the action is a python function. It was breaking (at least) some example output generated for documentation --- src/engine/SCons/Builder.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/engine/SCons/Builder.py b/src/engine/SCons/Builder.py index b5f1a92..010d5ff 100644 --- a/src/engine/SCons/Builder.py +++ b/src/engine/SCons/Builder.py @@ -307,7 +307,10 @@ def _node_errors(builder, env, tlist, slist): msg = "Two different environments were specified for target %s,\n\tbut they appear to have the same action: %s" % (t, action.genstring(tlist, slist, t.env)) SCons.Warnings.warn(SCons.Warnings.DuplicateEnvironmentWarning, msg) else: - msg = "Two environments with different actions were specified for the same target: %s\n(action 1: %s)\n(action 2: %s)" % (t,t_contents.decode('utf-8'),contents.decode('utf-8')) + try: + msg = "Two environments with different actions were specified for the same target: %s\n(action 1: %s)\n(action 2: %s)" % (t,t_contents.decode('utf-8'),contents.decode('utf-8')) + except UnicodeDecodeError as e: + msg = "Two environments with different actions were specified for the same target: %s"%t raise UserError(msg) if builder.multi: if t.builder != builder: -- cgit v0.12