Skip to content

Commit cc38abb

Browse files
author
Kartik Raj
committed
Remove old way and install new way
1 parent c06ec22 commit cc38abb

File tree

12 files changed

+117
-600
lines changed

12 files changed

+117
-600
lines changed

pythonFiles/deactivate renamed to pythonFiles/deactivate/bash/deactivate

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,11 @@ deactivate () {
2424
unset -f deactivate
2525
fi
2626
}
27-
# Read the JSON file
28-
JSON_FILE="/workspaces/vscode-python/pythonFiles/envVars_bash.json"
27+
28+
# Get the directory of the current script
29+
SCRIPT_DIR=$(dirname "$0")
30+
# Construct the path to envVars.json relative to the script directory
31+
JSON_FILE="$SCRIPT_DIR/envVars.json"
2932

3033
# Read the JSON file and set the variables
3134
TEMP_PS1=$(cat "$JSON_FILE" | jq -r '.PS1')
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Same as deactivate in "<venv>/bin/activate"
2+
deactivate () {
3+
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
4+
PATH="${_OLD_VIRTUAL_PATH:-}"
5+
export PATH
6+
unset _OLD_VIRTUAL_PATH
7+
fi
8+
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
9+
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
10+
export PYTHONHOME
11+
unset _OLD_VIRTUAL_PYTHONHOME
12+
fi
13+
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
14+
hash -r 2> /dev/null
15+
fi
16+
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
17+
PS1="${_OLD_VIRTUAL_PS1:-}"
18+
export PS1
19+
unset _OLD_VIRTUAL_PS1
20+
fi
21+
unset VIRTUAL_ENV
22+
unset VIRTUAL_ENV_PROMPT
23+
if [ ! "${1:-}" = "nondestructive" ] ; then
24+
unset -f deactivate
25+
fi
26+
}
27+
28+
# Get the directory of the current script
29+
SCRIPT_DIR=$(dirname "$0")
30+
# Construct the path to envVars.json relative to the script directory
31+
JSON_FILE="$SCRIPT_DIR/envVars.json"
32+
33+
# Read the JSON file and set the variables
34+
TEMP_PS1=$(cat "$JSON_FILE" | jq -r '.PS1')
35+
TEMP_PATH=$(cat "$JSON_FILE" | jq -r '.PATH')
36+
TEMP_PYTHONHOME=$(cat "$JSON_FILE" | jq -r '.PYTHONHOME')
37+
# Initialize the variables required by deactivate function
38+
_OLD_VIRTUAL_PS1="${TEMP_PS1:-}"
39+
_OLD_VIRTUAL_PATH="$TEMP_PATH"
40+
if [ -n "${PYTHONHOME:-}" ] ; then
41+
_OLD_VIRTUAL_PYTHONHOME="${TEMP_PYTHONHOME:-}"
42+
fi
43+
deactivate
44+
fish

pythonFiles/deactivate/zsh/deactivate

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Same as deactivate in "<venv>/bin/activate"
2+
deactivate () {
3+
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
4+
PATH="${_OLD_VIRTUAL_PATH:-}"
5+
export PATH
6+
unset _OLD_VIRTUAL_PATH
7+
fi
8+
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
9+
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
10+
export PYTHONHOME
11+
unset _OLD_VIRTUAL_PYTHONHOME
12+
fi
13+
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ] ; then
14+
hash -r 2> /dev/null
15+
fi
16+
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
17+
PS1="${_OLD_VIRTUAL_PS1:-}"
18+
export PS1
19+
unset _OLD_VIRTUAL_PS1
20+
fi
21+
unset VIRTUAL_ENV
22+
unset VIRTUAL_ENV_PROMPT
23+
if [ ! "${1:-}" = "nondestructive" ] ; then
24+
unset -f deactivate
25+
fi
26+
}
27+
28+
# Get the directory of the current script
29+
SCRIPT_DIR=$(dirname "$0")
30+
# Construct the path to envVars.json relative to the script directory
31+
JSON_FILE="$SCRIPT_DIR/envVars.json"
32+
33+
# Read the JSON file and set the variables
34+
TEMP_PS1=$(cat "$JSON_FILE" | jq -r '.PS1')
35+
TEMP_PATH=$(cat "$JSON_FILE" | jq -r '.PATH')
36+
TEMP_PYTHONHOME=$(cat "$JSON_FILE" | jq -r '.PYTHONHOME')
37+
# Initialize the variables required by deactivate function
38+
_OLD_VIRTUAL_PS1="${TEMP_PS1:-}"
39+
_OLD_VIRTUAL_PATH="$TEMP_PATH"
40+
if [ -n "${PYTHONHOME:-}" ] ; then
41+
_OLD_VIRTUAL_PYTHONHOME="${TEMP_PYTHONHOME:-}"
42+
fi
43+
deactivate
44+
zsh

src/client/terminals/envCollectionActivation/deactivatePrompt.ts

Lines changed: 0 additions & 201 deletions
This file was deleted.

0 commit comments

Comments
 (0)