summaryrefslogtreecommitdiffstats
path: root/src/engine/SCons/Tool
diff options
context:
space:
mode:
authorWilliam Deegan <bill@baddogconsulting.com>2017-04-16 18:21:23 (GMT)
committerWilliam Deegan <bill@baddogconsulting.com>2017-04-16 18:21:23 (GMT)
commit3e6dce496daca4c98655b4544541828f36dce707 (patch)
tree32c12ecbadee7a92dff4c16e31731430e5ec5470 /src/engine/SCons/Tool
parente2644d7ee935b61f3307aafd376a9bca732f50bc (diff)
parent9ced8fe7b4e2f878df32ab3f606f851ac4cb6efc (diff)
downloadSCons-3e6dce496daca4c98655b4544541828f36dce707.zip
SCons-3e6dce496daca4c98655b4544541828f36dce707.tar.gz
SCons-3e6dce496daca4c98655b4544541828f36dce707.tar.bz2
Merged in gauravjuvekar/scons (pull request #447)
Fix failing tests from merging #427
Diffstat (limited to 'src/engine/SCons/Tool')
-rw-r--r--src/engine/SCons/Tool/textfile.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/engine/SCons/Tool/textfile.py b/src/engine/SCons/Tool/textfile.py
index 0e4d943..42a79cd 100644
--- a/src/engine/SCons/Tool/textfile.py
+++ b/src/engine/SCons/Tool/textfile.py
@@ -71,7 +71,11 @@ def _do_subst(node, subs):
contents = re.sub(k, v, contents)
if 'b' in TEXTFILE_FILE_WRITE_MODE:
- contents = bytearray(contents, 'utf-8')
+ try:
+ contents = bytearray(contents, 'utf-8')
+ except UnicodeDecodeError:
+ # contents is already utf-8 encoded python 2 str i.e. a byte array
+ contents = bytearray(contents)
return contents