Skip to content

Set VIRTUALENVWRAPPER_SCRIPT portably #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions virtualenvwrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,11 @@ export VIRTUALENVWRAPPER_WORKON_CD=${VIRTUALENVWRAPPER_WORKON_CD:-1}
# Remember where we are running from.
if [ -z "${VIRTUALENVWRAPPER_SCRIPT:-}" ]
then
if [ -n "$BASH" ]
if [ -n "${BASH_SOURCE:-}" ]
then
export VIRTUALENVWRAPPER_SCRIPT="$BASH_SOURCE"
elif [ -n "$ZSH_VERSION" ]
then
export VIRTUALENVWRAPPER_SCRIPT="$0"
else
export VIRTUALENVWRAPPER_SCRIPT="${.sh.file}"
export VIRTUALENVWRAPPER_SCRIPT="$0"
fi
fi

Expand Down Expand Up @@ -430,7 +427,7 @@ function mkvirtualenv {
i=0
tst="-lt"
fi
while [ $i $tst $# ]
while test $i $tst $#
do
a="${in_args[$i]}"
# echo "arg $i : $a"
Expand Down Expand Up @@ -712,7 +709,7 @@ function workon {
tst="-lt"
fi
typeset cd_after_activate=$VIRTUALENVWRAPPER_WORKON_CD
while [ $i $tst $# ]
while test $i $tst $#
do
a="${in_args[$i]}"
case "$a" in
Expand Down Expand Up @@ -1111,7 +1108,7 @@ function mkproject {
i=0
tst="-lt"
fi
while [ $i $tst $# ]
while test $i $tst $#
do
a="${in_args[$i]}"
case "$a" in
Expand Down Expand Up @@ -1218,7 +1215,7 @@ function mktmpenv {
tst="-lt"
fi
typeset cd_after_activate=$VIRTUALENVWRAPPER_WORKON_CD
while [ $i $tst $# ]
while test $i $tst $#
do
a="${in_args[$i]}"
case "$a" in
Expand Down
Loading