8000 bpo-36634: Fixes activate.bat when existing values contain double quo… · python/cpython@574b324 · GitHub
[go: up one dir, main page]

Skip to content

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 574b324

Browse files
zoobazware
authored andcommitted
bpo-36634: Fixes activate.bat when existing values contain double quotes (GH-15924)
1 parent 6357c95 commit 574b324

File tree

2 files changed

+15
-25
lines changed

2 files changed

+15
-25
lines changed

Lib/venv/scripts/nt/activate.bat

Lines changed: 13 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,32 @@
22

33
rem This file is UTF-8 encoded, so we need to update the current code page while executing it
44
for /f "tokens=2 delims=:." %%a in ('"%SystemRoot%\System32\chcp.com"') do (
5-
set "_OLD_CODEPAGE=%%a"
5+
set _OLD_CODEPAGE=%%a
66
)
77
if defined _OLD_CODEPAGE (
88
"%SystemRoot%\System32\chcp.com" 65001 > nul
99
)
1010

11-
set "VIRTUAL_ENV=__VENV_DIR__"
11+
set VIRTUAL_ENV=__VENV_DIR__
1212

13-
if not defined PROMPT (
14-
set "PROMPT=$P$G"
15-
)
16-
17-
if defined _OLD_VIRTUAL_PROMPT (
18-
set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
19-
)
13+
if not defined PROMPT set PROMPT=$P$G
2014

21-
if defined _OLD_VIRTUAL_PYTHONHOME (
22-
set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%"
23-
)
15+
if defined _OLD_VIRTUAL_PROMPT set PROMPT=%_OLD_VIRTUAL_PROMPT%
16+
if defined _OLD_VIRTUAL_PYTHONHOME set PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%
2417

25-
set "_OLD_VIRTUAL_PROMPT=%PROMPT%"
26-
set "PROMPT=__VENV_PROMPT__%PROMPT%"
18+
set _OLD_VIRTUAL_PROMPT=%PROMPT%
19+
set PROMPT=__VENV_PROMPT__%PROMPT%
2720

28-
if defined PYTHONHOME (
29-
set "_OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%"
30-
set PYTHONHOME=
31-
)
21+
if defined PYTHONHOME set _OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%
22+
set PYTHONHOME=
3223

33-
if defined _OLD_VIRTUAL_PATH (
34-
set "PATH=%_OLD_VIRTUAL_PATH%"
35-
) else (
36-
set "_OLD_VIRTUAL_PATH=%PATH%"
37-
)
24+
if defined _OLD_VIRTUAL_PATH set PATH=%_OLD_VIRTUAL_PATH%
25+
else set _OLD_VIRTUAL_PATH=%PATH%
3826

39-
set "PATH=%VIRTUAL_ENV%\__VENV_BIN_NAME__;%PATH%"
27+
set PATH=%VIRTUAL_ENV%\__VENV_BIN_NAME__;%PATH%
4028

4129
:END
4230
if defined _OLD_CODEPAGE (
4331
"%SystemRoot%\System32\chcp.com" %_OLD_CODEPAGE% > nul
44-
set "_OLD_CODEPAGE="
32+
6143 set _OLD_CODEPAGE=
4533
)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
venv activate.bat now works when the existing variables contain double quote
2+
characters.

0 commit comments

Comments
 (0)
0