mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Unset SCRIPT_PATH
in relocatable activation script (#12672)
## Summary Restore it if it was previously set, etc. Closes https://github.com/astral-sh/uv/issues/12662.
This commit is contained in:
parent
2b62f73064
commit
ce3affa07e
1 changed files with 14 additions and 0 deletions
|
@ -22,6 +22,10 @@
|
|||
# This file must be used with "source bin/activate" *from bash*
|
||||
# you cannot run it directly
|
||||
|
||||
if ! [ -z "${SCRIPT_PATH+_}" ] ; then
|
||||
_OLD_SCRIPT_PATH="$SCRIPT_PATH"
|
||||
fi
|
||||
|
||||
# Get script path (only used if environment is relocatable).
|
||||
if [ -n "${BASH_VERSION:+x}" ] ; then
|
||||
SCRIPT_PATH="${BASH_SOURCE[0]}"
|
||||
|
@ -80,6 +84,16 @@ if ([ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]) && $(command -v cygpath
|
|||
fi
|
||||
export VIRTUAL_ENV
|
||||
|
||||
# Unset the `SCRIPT_PATH` variable, now that the `VIRTUAL_ENV` variable
|
||||
# has been set. This is important for relocatable environments.
|
||||
if ! [ -z "${_OLD_SCRIPT_PATH+_}" ] ; then
|
||||
SCRIPT_PATH="$_OLD_SCRIPT_PATH"
|
||||
export SCRIPT_PATH
|
||||
unset _OLD_SCRIPT_PATH
|
||||
else
|
||||
unset SCRIPT_PATH
|
||||
fi
|
||||
|
||||
_OLD_VIRTUAL_PATH="$PATH"
|
||||
PATH="$VIRTUAL_ENV/{{ BIN_NAME }}:$PATH"
|
||||
export PATH
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue