89
89
# existing builtin commands. We need to use a builtin for cd because
90
90
# we are trying to change the state of the current shell, so we use
91
91
# "builtin" for bash and zsh but "command" under ksh.
92
- function __virtualenvwrapper_cd {
93
- if [ -n " $BASH " ]
94
- then
95
- builtin \c d " $@ "
96
- elif [ -n " $ZSH_VERSION " ]
97
- then
98
- builtin \c d " $@ "
99
- else
100
- command \c d " $@ "
101
- fi
92
+ function virtualenvwrapper_cd {
93
+ if [ -n " $BASH " ]
94
+ then
95
+ builtin \c d " $@ "
96
+ elif [ -n " $ZSH_VERSION " ]
97
+ then
98
+ builtin \c d " $@ "
99
+ else
100
+ command \c d " $@ "
101
+ fi
102
102
}
103
103
104
104
function virtualenvwrapper_expandpath {
105
- if [ " $1 " = " " ]; then
106
- return 1
107
- else
108
- " $VIRTUALENVWRAPPER_PYTHON " -c " import os,sys; sys.stdout.write(os.path.normpath(os.path.expanduser(os.path.expandvars(\" $1 \" )))+'\n')"
109
- return 0
110
- fi
105
+ if [ " $1 " = " " ]; then
106
+ return 1
107
+ else
108
+ " $VIRTUALENVWRAPPER_PYTHON " -c " import os,sys; sys.stdout.write(os.path.normpath(os.path.expanduser(os.path.expandvars(\" $1 \" )))+'\n')"
109
+ return 0
110
+ fi
111
111
}
112
112
113
113
function virtualenvwrapper_derive_workon_home {
@@ -166,8 +166,8 @@ function virtualenvwrapper_verify_workon_home {
166
166
167
167
# Function to wrap mktemp so tests can replace it for error condition
168
168
# testing.
169
- function __virtualenvwrapper_mktemp {
170
- command \m ktemp " $@ "
169
+ function virtualenvwrapper_mktemp {
170
+ command \m ktemp " $@ "
171
171
}
172
172
173
173
# Expects 1 argument, the suffix for the new file.
@@ -176,7 +176,7 @@ function virtualenvwrapper_tempfile {
176
176
typeset suffix=${1:- hook}
177
177
typeset file
178
178
179
- file=" $( __virtualenvwrapper_mktemp -t virtualenvwrapper-$suffix -XXXXXXXXXX) "
179
+ file=" $( virtualenvwrapper_mktemp -t virtualenvwrapper-$suffix -XXXXXXXXXX) "
180
180
if [ $? -ne 0 ] || [ -z " $file " ] || [ ! -f " $file " ]
181
181
then
182
182
echo " ERROR: virtualenvwrapper could not create a temporary file name." 1>&2
@@ -212,8 +212,8 @@ function virtualenvwrapper_run_hook {
212
212
fi
213
213
# cat "$hook_script"
214
214
source " $hook_script "
215
- elif [ " ${1} " = " initialize" ]
216
- then
215
+ elif [ " ${1} " = " initialize" ]
216
+ then
217
217
cat - 1>&2 << EOF
218
218
virtualenvwrapper.sh: There was a problem running the initialization hooks.
219
219
@@ -424,7 +424,7 @@ function mkvirtualenv {
424
424
virtualenvwrapper_verify_virtualenv || return 1
425
425
(
426
426
[ -n " $ZSH_VERSION " ] && setopt SH_WORD_SPLIT
427
- __virtualenvwrapper_cd " $WORKON_HOME " &&
427
+ virtualenvwrapper_cd " $WORKON_HOME " &&
428
428
" $VIRTUALENVWRAPPER_VIRTUALENV " $VIRTUALENVWRAPPER_VIRTUALENV_ARGS " $@ " &&
429
429
[ -d " $WORKON_HOME /$envname " ] && \
430
430
virtualenvwrapper_run_hook " pre_mkvirtualenv" " $envname "
@@ -485,7 +485,7 @@ function rmvirtualenv {
485
485
# Move out of the current directory to one known to be
486
486
# safe, in case we are inside the environment somewhere.
487
487
typeset prior_dir=" $( pwd) "
488
- __virtualenvwrapper_cd " $WORKON_HOME "
488
+ virtualenvwrapper_cd " $WORKON_HOME "
489
489
490
490
virtualenvwrapper_run_hook " pre_rmvirtualenv" " $env_name "
491
491
command \r m -rf " $env_dir "
@@ -494,7 +494,7 @@ function rmvirtualenv {
494
494
# If the directory we used to be in still exists, move back to it.
495
495
if [ -d " $prior_dir " ]
496
496
then
497
- __virtualenvwrapper_cd " $prior_dir "
497
+ virtualenvwrapper_cd " $prior_dir "
498
498
fi
499
499
done
500
500
}
@@ -505,7 +505,7 @@ function virtualenvwrapper_show_workon_options {
505
505
# NOTE: DO NOT use ls here because colorized versions spew control characters
506
506
# into the output list.
507
507
# echo seems a little faster than find, even with -depth 3.
508
- (__virtualenvwrapper_cd " $WORKON_HOME " ; for f in * /$VIRTUALENVWRAPPER_ENV_BIN_DIR /activate; do echo $f ; done) 2> /dev/null | command \s ed ' s|^\./||' | command \s ed " s|/$VIRTUALENVWRAPPER_ENV_BIN_DIR /activate||" | command \s ort | (unset GREP_OPTIONS; command \e grep -v ' ^\*$' )
508
+ (virtualenvwrapper_cd " $WORKON_HOME " ; for f in * /$VIRTUALENVWRAPPER_ENV_BIN_DIR /activate; do echo $f ; done) 2> /dev/null | command \s ed ' s|^\./||' | command \s ed " s|/$VIRTUALENVWRAPPER_ENV_BIN_DIR /activate||" | command \s ort | (unset GREP_OPTIONS; command \e grep -v ' ^\*$' )
509
509
}
510
510
511
511
function _lsvirtualenv_usage {
@@ -752,14 +752,14 @@ function cdsitepackages {
752
752
virtualenvwrapper_verify_workon_home || return 1
753
753
virtualenvwrapper_verify_active_environment || return 1
754
754
typeset site_packages=" ` virtualenvwrapper_get_site_packages_dir` "
755
- __virtualenvwrapper_cd " $site_packages " /$1
755
+ virtualenvwrapper_cd " $site_packages " /$1
756
756
}
757
757
758
758
# Does a ``cd`` to the root of the currently-active virtualenv.
759
759
function cdvirtualenv {
760
760
virtualenvwrapper_verify_workon_home || return 1
761
761
virtualenvwrapper_verify_active_environment || return 1
762
- __virtualenvwrapper_cd $VIRTUAL_ENV /$1
762
+ virtualenvwrapper_cd $VIRTUAL_ENV /$1
763
763
}
764
764
765
765
# Shows the content of the site-packages directory of the currently-active
@@ -847,7 +847,7 @@ function cpvirtualenv {
847
847
echo " Copying $src_name as $trg_name ..."
848
848
(
849
849
[ -n " $ZSH_VERSION " ] && setopt SH_WORD_SPLIT
850
- __virtualenvwrapper_cd " $WORKON_HOME " &&
850
+ virtualenvwrapper_cd " $WORKON_HOME " &&
851
851
" $VIRTUALENVWRAPPER_VIRTUALENV_CLONE " " $src " " $trg "
852
852
[ -d " $trg " ] &&
853
853
virtualenvwrapper_run_hook " pre_cpvirtualenv" " $src " " $trg_name " &&
0 commit comments