mirror of https://github.com/python/cpython
Closes #16340: Merged fix from 3.3.
This commit is contained in:
commit
526417fc59
|
@ -313,11 +313,17 @@ class EnvBuilder:
|
||||||
mode = 'wb'
|
mode = 'wb'
|
||||||
else:
|
else:
|
||||||
mode = 'w'
|
mode = 'w'
|
||||||
data = data.decode('utf-8')
|
try:
|
||||||
data = self.replace_variables(data, context)
|
data = data.decode('utf-8')
|
||||||
with open(dstfile, mode) as f:
|
data = self.replace_variables(data, context)
|
||||||
f.write(data)
|
except UnicodeDecodeError as e:
|
||||||
shutil.copymode(srcfile, dstfile)
|
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:
|
||||||
|
f.write(data)
|
||||||
|
shutil.copymode(srcfile, dstfile)
|
||||||
|
|
||||||
|
|
||||||
def create(env_dir, system_site_packages=False, clear=False, symlinks=False):
|
def create(env_dir, system_site_packages=False, clear=False, symlinks=False):
|
||||||
|
|
Loading…
Reference in New Issue