Commit 2ce42588 authored by Vinay Sajip's avatar Vinay Sajip

Merged upstream changes.

parents 1b70ff64 141bca7c
...@@ -305,8 +305,14 @@ class EnvBuilder: ...@@ -305,8 +305,14 @@ class EnvBuilder:
mode = 'wb' mode = 'wb'
else: else:
mode = 'w' mode = 'w'
try:
data = data.decode('utf-8') data = data.decode('utf-8')
data = self.replace_variables(data, context) data = self.replace_variables(data, context)
except UnicodeDecodeError as e:
data = None
logger.warning('unable to copy script %r, '
'may be binary: %s', srcfile, e)
if data is not None:
with open(dstfile, mode) as f: with open(dstfile, mode) as f:
f.write(data) f.write(data)
shutil.copymode(srcfile, dstfile) shutil.copymode(srcfile, dstfile)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment