summaryrefslogtreecommitdiffstats
path: root/Lib/venv/scripts/nt
diff options
context:
space:
mode:
authorBrett Cannon <brettcannon@users.noreply.github.com>2018-09-21 22:27:26 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-09-21 22:27:26 (GMT)
commitd64ee1a5ba2007ae5fe085dd3495013d940a51bb (patch)
treecb0a2cb25675bbc938ed79d91670e5b07ba34640 /Lib/venv/scripts/nt
parentdb1a80e97aa7217c561fb3627f70be1882de9534 (diff)
downloadcpython-d64ee1a5ba2007ae5fe085dd3495013d940a51bb.zip
cpython-d64ee1a5ba2007ae5fe085dd3495013d940a51bb.tar.gz
cpython-d64ee1a5ba2007ae5fe085dd3495013d940a51bb.tar.bz2
bpo-32718: Make Activate.ps1 for venv cross-platform and available on all platforms (GH-9321)
PowerShell Core 6.1 is the cross-platform port of Windows PowerShell. This change updates Activate.ps1 to not make Windows assumptions as well as installing it into the bin/Scripts directory on all operating systems. Requires PowerShell Core 6.1 for proper readline support once the shell has been activated for the virtual environment.
Diffstat (limited to 'Lib/venv/scripts/nt')
-rw-r--r--Lib/venv/scripts/nt/Activate.ps151
1 files changed, 0 insertions, 51 deletions
diff --git a/Lib/venv/scripts/nt/Activate.ps1 b/Lib/venv/scripts/nt/Activate.ps1
deleted file mode 100644
index bf60869..0000000
--- a/Lib/venv/scripts/nt/Activate.ps1
+++ /dev/null
@@ -1,51 +0,0 @@
-function global:deactivate ([switch]$NonDestructive) {
- # Revert to original values
- if (Test-Path function:_OLD_VIRTUAL_PROMPT) {
- copy-item function:_OLD_VIRTUAL_PROMPT function:prompt
- remove-item function:_OLD_VIRTUAL_PROMPT
- }
-
- if (Test-Path env:_OLD_VIRTUAL_PYTHONHOME) {
- copy-item env:_OLD_VIRTUAL_PYTHONHOME env:PYTHONHOME
- remove-item env:_OLD_VIRTUAL_PYTHONHOME
- }
-
- if (Test-Path env:_OLD_VIRTUAL_PATH) {
- copy-item env:_OLD_VIRTUAL_PATH env:PATH
- remove-item env:_OLD_VIRTUAL_PATH
- }
-
- if (Test-Path env:VIRTUAL_ENV) {
- remove-item env:VIRTUAL_ENV
- }
-
- if (!$NonDestructive) {
- # Self destruct!
- remove-item function:deactivate
- }
-}
-
-deactivate -nondestructive
-
-$env:VIRTUAL_ENV="__VENV_DIR__"
-
-if (! $env:VIRTUAL_ENV_DISABLE_PROMPT) {
- # Set the prompt to include the env name
- # Make sure _OLD_VIRTUAL_PROMPT is global
- function global:_OLD_VIRTUAL_PROMPT {""}
- copy-item function:prompt function:_OLD_VIRTUAL_PROMPT
- function global:prompt {
- Write-Host -NoNewline -ForegroundColor Green '__VENV_PROMPT__'
- _OLD_VIRTUAL_PROMPT
- }
-}
-
-# Clear PYTHONHOME
-if (Test-Path env:PYTHONHOME) {
- copy-item env:PYTHONHOME env:_OLD_VIRTUAL_PYTHONHOME
- remove-item env:PYTHONHOME
-}
-
-# Add the venv to the PATH
-copy-item env:PATH env:_OLD_VIRTUAL_PATH
-$env:PATH = "$env:VIRTUAL_ENV\__VENV_BIN_NAME__;$env:PATH"