mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
Closes #29213: Merged fix from 3.6.
This commit is contained in:
parent
7601d780a7
commit
144fff8b90
2 changed files with 5 additions and 7 deletions
|
@ -320,19 +320,17 @@ class EnvBuilder:
|
||||||
dstfile = os.path.join(dstdir, f)
|
dstfile = os.path.join(dstdir, f)
|
||||||
with open(srcfile, 'rb') as f:
|
with open(srcfile, 'rb') as f:
|
||||||
data = f.read()
|
data = f.read()
|
||||||
if srcfile.endswith('.exe'):
|
if not srcfile.endswith('.exe'):
|
||||||
mode = 'wb'
|
|
||||||
else:
|
|
||||||
mode = 'w'
|
|
||||||
try:
|
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 = data.encode('utf-8')
|
||||||
|
except UnicodeError as e:
|
||||||
data = None
|
data = None
|
||||||
logger.warning('unable to copy script %r, '
|
logger.warning('unable to copy script %r, '
|
||||||
'may be binary: %s', srcfile, e)
|
'may be binary: %s', srcfile, e)
|
||||||
if data is not None:
|
if data is not None:
|
||||||
with open(dstfile, mode) as f:
|
with open(dstfile, 'wb') as f:
|
||||||
f.write(data)
|
f.write(data)
|
||||||
shutil.copymode(srcfile, dstfile)
|
shutil.copymode(srcfile, dstfile)
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ function global:deactivate ([switch]$NonDestructive) {
|
||||||
}
|
}
|
||||||
|
|
||||||
deactivate -nondestructive
|
deactivate -nondestructive
|
||||||
|
|
||||||
$env:VIRTUAL_ENV="__VENV_DIR__"
|
$env:VIRTUAL_ENV="__VENV_DIR__"
|
||||||
|
|
||||||
if (! $env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
if (! $env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue