Skip to content

Commit 4757399

Browse files
committed
update: help python shits.
1 parent 3153e95 commit 4757399

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

.vscode/.zshrc

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,39 @@ if [ -d "$PROJECT_FOLDER/venv" ]; then
148148
if [ -n "${VIRTUAL_ENV}" ];then
149149
echo "Virtual Environment is already activated."
150150
echo "Virtual Environment Home: ${VIRTUAL_ENV}"
151-
else
152-
source $PROJECT_FOLDER/venv/bin/activate
151+
echo "Trying to deactivate the virtual environment automatically."
152+
153+
# force deactivate the virtual environment
154+
if [ -n "${_OLD_VIRTUAL_PATH:-}" ]
155+
then
156+
PATH="${_OLD_VIRTUAL_PATH:-}"
157+
export PATH
158+
unset _OLD_VIRTUAL_PATH
159+
fi
160+
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ]
161+
then
162+
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
163+
export PYTHONHOME
164+
unset _OLD_VIRTUAL_PYTHONHOME
165+
fi
166+
if [ -n "${BASH:-}" -o -n "${ZSH_VERSION:-}" ]
167+
then
168+
hash -r 2> /dev/null
169+
fi
170+
if [ -n "${_OLD_VIRTUAL_PS1:-}" ]
171+
then
172+
PS1="${_OLD_VIRTUAL_PS1:-}"
173+
export PS1
174+
unset _OLD_VIRTUAL_PS1
175+
fi
176+
unset VIRTUAL_ENV
177+
unset VIRTUAL_ENV_PROMPT
178+
if [ ! "${1:-}" = "nondestructive" ]
179+
then
180+
# deactivate always useless here
181+
# unset -f deactivate
182+
fi
153183
fi
184+
185+
source $PROJECT_FOLDER/venv/bin/activate
154186
fi

.vscode/tasks.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@
234234
"python3.12",
235235
"python",
236236
],
237-
"default": "python3.12"
237+
"default": "python"
238238
}
239239
]
240240
}

0 commit comments

Comments
 (0)