summaryrefslogtreecommitdiffstats
path: root/Lib/venv
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2020-01-14 20:49:30 (GMT)
committerGitHub <noreply@github.com>2020-01-14 20:49:30 (GMT)
commit7d6378051feeadf45b4ce45b4b406b65df255648 (patch)
tree1046f35a3335e2ad083d1d5bdcc277035a2ddc23 /Lib/venv
parent4b0d91aab4cfba30a2a9728e9eaea15dbc0ba9bd (diff)
downloadcpython-7d6378051feeadf45b4ce45b4b406b65df255648.zip
cpython-7d6378051feeadf45b4ce45b4b406b65df255648.tar.gz
cpython-7d6378051feeadf45b4ce45b4b406b65df255648.tar.bz2
bpo-38901: Allow setting a venv's prompt to the basename of the current directory. (GH-17946)
When a prompt value of '.' is specified, os.path.basename(os.getcwd()) is used to configure the prompt for the created venv.
Diffstat (limited to 'Lib/venv')
-rw-r--r--Lib/venv/__init__.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/venv/__init__.py b/Lib/venv/__init__.py
index 81cb1d1..a220ef7 100644
--- a/Lib/venv/__init__.py
+++ b/Lib/venv/__init__.py
@@ -51,6 +51,8 @@ class EnvBuilder:
self.symlinks = symlinks
self.upgrade = upgrade
self.with_pip = with_pip
+ if prompt == '.': # see bpo-38901
+ prompt = os.path.basename(os.getcwd())
self.prompt = prompt
self.upgrade_deps = upgrade_deps