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
d5a70c6b
Commit
d5a70c6b
authored
Mar 08, 2019
by
Cheryl Sabella
Committed by
GitHub
Mar 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-35661: Store the venv prompt in pyvenv.cfg (GH-11440)
parent
2aab5d31
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
0 deletions
+9
-0
Lib/test/test_venv.py
Lib/test/test_venv.py
+6
-0
Lib/venv/__init__.py
Lib/venv/__init__.py
+2
-0
Misc/NEWS.d/next/Library/2019-01-05-16-16-20.bpo-35661.H_UOXc.rst
...S.d/next/Library/2019-01-05-16-16-20.bpo-35661.H_UOXc.rst
+1
-0
No files found.
Lib/test/test_venv.py
View file @
d5a70c6b
...
...
@@ -113,10 +113,16 @@ class BasicTest(BaseTest):
builder
=
venv
.
EnvBuilder
()
context
=
builder
.
ensure_directories
(
self
.
env_dir
)
self
.
assertEqual
(
context
.
prompt
,
'(%s) '
%
env_name
)
builder
.
create
(
self
.
env_dir
)
data
=
self
.
get_text_file_contents
(
'pyvenv.cfg'
)
self
.
assertNotIn
(
"prompt = "
,
data
)
builder
=
venv
.
EnvBuilder
(
prompt
=
'My prompt'
)
context
=
builder
.
ensure_directories
(
self
.
env_dir
)
self
.
assertEqual
(
context
.
prompt
,
'(My prompt) '
)
builder
.
create
(
self
.
env_dir
)
data
=
self
.
get_text_file_contents
(
'pyvenv.cfg'
)
self
.
assertIn
(
"prompt = 'My prompt'
\
n
"
,
data
)
@
skipInVenv
def
test_prefixes
(
self
):
...
...
Lib/venv/__init__.py
View file @
d5a70c6b
...
...
@@ -154,6 +154,8 @@ class EnvBuilder:
incl
=
'false'
f
.
write
(
'include-system-site-packages = %s
\
n
'
%
incl
)
f
.
write
(
'version = %d.%d.%d
\
n
'
%
sys
.
version_info
[:
3
])
if
self
.
prompt
is
not
None
:
f
.
write
(
f'prompt =
{
self
.
prompt
!
r
}\
n
'
)
def
symlink_or_copy
(
self
,
src
,
dst
,
relative_symlinks_ok
=
False
):
"""
...
...
Misc/NEWS.d/next/Library/2019-01-05-16-16-20.bpo-35661.H_UOXc.rst
0 → 100644
View file @
d5a70c6b
Store the venv prompt in pyvenv.cfg.
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