Skip to content

Commit 6aeac30

Browse files
committed
Merged in agriffis/virtualenvwrapper (pull request #22)
2 parents 2866557 + 865dc41 commit 6aeac30

File tree

1 file changed

+43
-43
lines changed

1 file changed

+43
-43
lines changed

virtualenvwrapper.sh

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ fi
6060
VIRTUALENVWRAPPER_ENV_BIN_DIR="bin"
6161
if [ "$OS" = "Windows_NT" ] && [ "$MSYSTEM" = "MINGW32" ]
6262
then
63-
# Only assign this for msys, cygwin use standard Unix paths
64-
# and its own python installation
65-
VIRTUALENVWRAPPER_ENV_BIN_DIR="Scripts"
63+
# Only assign this for msys, cygwin use standard Unix paths
64+
# and its own python installation
65+
VIRTUALENVWRAPPER_ENV_BIN_DIR="Scripts"
6666
fi
6767

6868
# Let the user override the name of the file that holds the project
@@ -140,7 +140,7 @@ function virtualenvwrapper_tempfile {
140140
# Note: the 'X's must come last
141141
typeset suffix=${1:-hook}
142142
typeset file
143-
143+
144144
file="`\mktemp -t virtualenvwrapper-$suffix-XXXXXXXXXX`"
145145
if [ $? -ne 0 ] || [ -z "$file" ] || [ ! -f "$file" ]
146146
then
@@ -155,13 +155,13 @@ function virtualenvwrapper_tempfile {
155155
function virtualenvwrapper_run_hook {
156156
typeset hook_script
157157
typeset result
158-
158+
159159
hook_script="$(virtualenvwrapper_tempfile ${1}-hook)" || return 1
160160

161161
if [ -z "$VIRTUALENVWRAPPER_LOG_DIR" ]
162162
then
163163
echo "ERROR: VIRTUALENVWRAPPER_LOG_DIR is not set." 1>&2
164-
\rm -f "$hook_script"
164+
\rm -f "$hook_script"
165165
return 1
166166
fi
167167
"$VIRTUALENVWRAPPER_PYTHON" -c 'from virtualenvwrapper.hook_loader import main; main()' $HOOK_VERBOSE_OPTION --script "$hook_script" "$@"
@@ -172,7 +172,7 @@ function virtualenvwrapper_run_hook {
172172
if [ ! -f "$hook_script" ]
173173
then
174174
echo "ERROR: virtualenvwrapper_run_hook could not find temporary file $hook_script" 1>&2
175-
\rm -f "$hook_script"
175+
\rm -f "$hook_script"
176176
return 2
177177
fi
178178
# cat "$hook_script"
@@ -386,8 +386,8 @@ function mkvirtualenv {
386386
# we should switch to the environment and run the hook.
387387
[ ! -d "$WORKON_HOME/$envname" ] && return 0
388388

389-
# If they gave us a project directory, set it up now
390-
# so the activate hooks can find it.
389+
# If they gave us a project directory, set it up now
390+
# so the activate hooks can find it.
391391
if [ ! -z "$project" ]
392392
then
393393
setvirtualenvproject "$WORKON_HOME/$envname" "$project"
@@ -474,38 +474,38 @@ function lsvirtualenv {
474474
typeset long_mode=true
475475
if command -v "getopts" &> /dev/null
476476
then
477-
# Use getopts when possible
478-
OPTIND=1
479-
while getopts ":blh" opt "$@"
480-
do
481-
case "$opt" in
482-
l) long_mode=true;;
483-
b) long_mode=false;;
484-
h) _lsvirtualenv_usage;
485-
return 1;;
486-
?) echo "Invalid option: -$OPTARG" >&2;
487-
_lsvirtualenv_usage;
488-
return 1;;
489-
esac
490-
done
477+
# Use getopts when possible
478+
OPTIND=1
479+
while getopts ":blh" opt "$@"
480+
do
481+
case "$opt" in
482+
l) long_mode=true;;
483+
b) long_mode=false;;
484+
h) _lsvirtualenv_usage;
485+
return 1;;
486+
?) echo "Invalid option: -$OPTARG" >&2;
487+
_lsvirtualenv_usage;
488+
return 1;;
489+
esac
490+
done
491491
else
492-
# fallback on getopt for other shell
493-
typeset -a args
494-
args=($(getopt blh "$@"))
495-
if [ $? != 0 ]
496-
then
497-
_lsvirtualenv_usage
498-
return 1
499-
fi
500-
for opt in $args
501-
do
502-
case "$opt" in
503-
-l) long_mode=true;;
504-
-b) long_mode=false;;
505-
-h) _lsvirtualenv_usage;
506-
return 1;;
507-
esac
508-
done
492+
# fallback on getopt for other shell
493+
typeset -a args
494+
args=($(getopt blh "$@"))
495+
if [ $? != 0 ]
496+
then
497+
_lsvirtualenv_usage
498+
return 1
499+
fi
500+
for opt in $args
501+
do
502+
case "$opt" in
503+
-l) long_mode=true;;
504+
-b) long_mode=false;;
505+
-h) _lsvirtualenv_usage;
506+
return 1;;
507+
esac
508+
done
509509
fi
510510

511511
if $long_mode
@@ -544,8 +544,8 @@ function showvirtualenv {
544544
# Usage: workon [environment_name]
545545
#
546546
function workon {
547-
typeset env_name="$1"
548-
if [ "$env_name" = "" ]
547+
typeset env_name="$1"
548+
if [ "$env_name" = "" ]
549549
then
550550
lsvirtualenv -b
551551
return 1
@@ -606,7 +606,7 @@ function workon {
606606

607607
virtualenvwrapper_run_hook "post_activate"
608608

609-
return 0
609+
return 0
610610
}
611611

612612

0 commit comments

Comments
 (0)