Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
dff9e253
Commit
dff9e253
authored
Oct 02, 2013
by
Vinay Sajip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Closes #19139: Changed usage of __VENV_NAME__ and added __VENV_PROMPT__.
parent
7c411a40
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
7 deletions
+11
-7
Doc/library/venv.rst
Doc/library/venv.rst
+3
-0
Lib/venv/__init__.py
Lib/venv/__init__.py
+2
-1
Lib/venv/scripts/nt/Activate.ps1
Lib/venv/scripts/nt/Activate.ps1
+1
-1
Lib/venv/scripts/nt/activate.bat
Lib/venv/scripts/nt/activate.bat
+1
-1
Lib/venv/scripts/posix/activate
Lib/venv/scripts/posix/activate
+2
-2
Lib/venv/scripts/posix/activate.fish
Lib/venv/scripts/posix/activate.fish
+2
-2
No files found.
Doc/library/venv.rst
View file @
dff9e253
...
...
@@ -187,6 +187,9 @@ creation according to their needs, the :class:`EnvBuilder` class.
* ``__VENV_NAME__`` is replaced with the environment name (final path
segment of environment directory).
* ``__VENV_PROMPT__`` is replaced with the prompt (the environment
name surrounded by parentheses and with a following space)
* ``__VENV_BIN_NAME__`` is replaced with the name of the bin directory
(either ``bin`` or ``Scripts``).
...
...
Lib/venv/__init__.py
View file @
dff9e253
...
...
@@ -261,7 +261,8 @@ class EnvBuilder:
being processed.
"""
text
=
text
.
replace
(
'__VENV_DIR__'
,
context
.
env_dir
)
text
=
text
.
replace
(
'__VENV_NAME__'
,
context
.
prompt
)
text
=
text
.
replace
(
'__VENV_NAME__'
,
context
.
env_name
)
text
=
text
.
replace
(
'__VENV_PROMPT__'
,
context
.
prompt
)
text
=
text
.
replace
(
'__VENV_BIN_NAME__'
,
context
.
bin_name
)
text
=
text
.
replace
(
'__VENV_PYTHON__'
,
context
.
env_exe
)
return
text
...
...
Lib/venv/scripts/nt/Activate.ps1
View file @
dff9e253
...
...
@@ -34,7 +34,7 @@ $env:VIRTUAL_ENV="__VENV_DIR__"
function
global
:
_OLD_VIRTUAL_PROMPT
{
""
}
copy-item
function:prompt
function:_OLD_VIRTUAL_PROMPT
function
global
:
prompt
{
Write-Host
-NoNewline
-ForegroundColor
Green
'__VENV_
NAME
__'
Write-Host
-NoNewline
-ForegroundColor
Green
'__VENV_
PROMPT
__'
_OLD_VIRTUAL_PROMPT
}
...
...
Lib/venv/scripts/nt/activate.bat
View file @
dff9e253
...
...
@@ -14,7 +14,7 @@ if defined _OLD_VIRTUAL_PYTHONHOME (
)
set
"_OLD_VIRTUAL_PROMPT=
%PROMPT%
"
set
"PROMPT=__VENV_
NAME
__
%PROMPT%
"
set
"PROMPT=__VENV_
PROMPT
__
%PROMPT%
"
if
defined
PYTHONHOME
(
set
"_OLD_VIRTUAL_PYTHONHOME=
%PYTHONHOME%
"
...
...
Lib/venv/scripts/posix/activate
View file @
dff9e253
...
...
@@ -54,8 +54,8 @@ fi
if [ -z "$VIRTUAL_ENV_DISABLE_PROMPT" ] ; then
_OLD_VIRTUAL_PS1="$PS1"
if [ "x__VENV_
NAME
__" != x ] ; then
PS1="__VENV_
NAME
__$PS1"
if [ "x__VENV_
PROMPT
__" != x ] ; then
PS1="__VENV_
PROMPT
__$PS1"
else
if [ "`basename \"$VIRTUAL_ENV\"`" = "__" ] ; then
# special case for Aspen magic directories
...
...
Lib/venv/scripts/posix/activate.fish
View file @
dff9e253
...
...
@@ -55,8 +55,8 @@ if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
# with the original prompt function renamed, we can override with our own.
function fish_prompt
# Prompt override?
if test -n "__VENV_
NAME
__"
printf "%s%s%s" "__VENV_
NAME
__" (set_color normal) (_old_fish_prompt)
if test -n "__VENV_
PROMPT
__"
printf "%s%s%s" "__VENV_
PROMPT
__" (set_color normal) (_old_fish_prompt)
return
end
# ...Otherwise, prepend env
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment