73
73
fi
74
74
75
75
# Verify that the WORKON_HOME directory exists
76
- function virtualenvwrapper_verify_workon_home () {
76
+ virtualenvwrapper_verify_workon_home () {
77
77
if [ ! -d " $WORKON_HOME " ]
78
78
then
79
79
[ " $1 " != " -q" ] && echo " ERROR: Virtual environments directory '$WORKON_HOME ' does not exist. Create it or set WORKON_HOME to an existing directory." >&2
@@ -85,7 +85,7 @@ function virtualenvwrapper_verify_workon_home () {
85
85
# HOOK_VERBOSE_OPTION="-v"
86
86
87
87
# Run the hooks
88
- function virtualenvwrapper_run_hook () {
88
+ virtualenvwrapper_run_hook () {
89
89
# First anything that runs directly from the plugin
90
90
" $VIRTUALENVWRAPPER_PYTHON " -m virtualenvwrapper.hook_loader $HOOK_VERBOSE_OPTION " $@ "
91
91
# Now anything that wants to run inside this shell
@@ -96,15 +96,15 @@ function virtualenvwrapper_run_hook () {
96
96
}
97
97
98
98
# Set up virtualenvwrapper properly
99
- function virtualenvwrapper_initialize () {
99
+ virtualenvwrapper_initialize () {
100
100
virtualenvwrapper_verify_workon_home -q || return 1
101
101
virtualenvwrapper_run_hook " initialize"
102
102
}
103
103
104
104
virtualenvwrapper_initialize
105
105
106
106
# Verify that virtualenv is installed and visible
107
- function virtualenvwrapper_verify_virtualenv () {
107
+ virtualenvwrapper_verify_virtualenv () {
108
108
venv=$( which virtualenv | grep -v " not found" )
109
109
if [ " $venv " = " " ]
110
110
then
@@ -120,7 +120,7 @@ function virtualenvwrapper_verify_virtualenv () {
120
120
}
121
121
122
122
# Verify that the requested environment exists
123
- function virtualenvwrapper_verify_workon_environment () {
123
+ virtualenvwrapper_verify_workon_environment () {
124
124
typeset env_name=" $1 "
125
125
if [ ! -d " $WORKON_HOME /$env_name " ]
126
126
then
@@ -131,7 +131,7 @@ function virtualenvwrapper_verify_workon_environment () {
131
131
}
132
132
133
133
# Verify that the active environment exists
134
- function virtualenvwrapper_verify_active_environment () {
134
+ virtualenvwrapper_verify_active_environment () {
135
135
if [ ! -n " ${VIRTUAL_ENV} " ] || [ ! -d " ${VIRTUAL_ENV} " ]
136
136
then
137
137
echo " ERROR: no virtualenv active, or active virtualenv is missing" >&2
@@ -145,7 +145,7 @@ function virtualenvwrapper_verify_active_environment () {
145
145
# Usage: mkvirtualenv [options] ENVNAME
146
146
# (where the options are passed directly to virtualenv)
147
147
#
148
- function mkvirtualenv () {
148
+ mkvirtualenv () {
149
149
eval " envname=\$ $# "
150
150
virtualenvwrapper_verify_workon_home || return 1
151
151
virtualenvwrapper_verify_virtualenv || return 1
@@ -163,7 +163,7 @@ function mkvirtualenv () {
163
163
}
164
164
165
165
# Remove an environment, in the WORKON_HOME.
166
- function rmvirtualenv () {
166
+ rmvirtualenv () {
167
167
typeset env_name=" $1 "
168
168
virtualenvwrapper_verify_workon_home || return 1
169
169
if [ " $env_name " = " " ]
@@ -184,7 +184,7 @@ function rmvirtualenv () {
184
184
}
185
185
186
186
# List the available environments.
187
- function virtualenvwrapper_show_workon_options () {
187
+ virtualenvwrapper_show_workon_options () {
188
188
virtualenvwrapper_verify_workon_home || return 1
189
189
# NOTE: DO NOT use ls here because colorized versions spew control characters
190
190
# into the output list.
@@ -197,7 +197,7 @@ function virtualenvwrapper_show_workon_options () {
197
197
#
198
198
# Usage: workon [environment_name]
199
199
#
200
- function workon () {
200
+ workon () {
201
201
typeset env_name=" $1 "
202
202
if [ " $env_name " = " " ]
203
203
then
@@ -232,7 +232,7 @@ function workon () {
232
232
virtualenvwrapper_saved_deactivate=$( typeset -f deactivate)
233
233
234
234
# Replace the deactivate() function with a wrapper.
235
- eval ' function deactivate () {
235
+ eval ' deactivate () {
236
236
# Call the local hook before the global so we can undo
237
237
# any settings made by the local postactivate first.
238
238
virtualenvwrapper_run_hook "pre_deactivate"
@@ -288,12 +288,12 @@ elif [ -n "$ZSH_VERSION" ] ; then
288
288
fi
289
289
290
290
# Prints the Python version string for the current interpreter.
291
- function virtualenvwrapper_get_python_version () {
291
+ virtualenvwrapper_get_python_version () {
292
292
python -c ' import sys; print ".".join(str(p) for p in sys.version_info[:2])'
293
293
}
294
294
295
295
# Prints the path to the site-packages directory for the current environment.
296
- function virtualenvwrapper_get_site_packages_dir () {
296
+ virtualenvwrapper_get_site_packages_dir () {
297
297
echo " $VIRTUAL_ENV /lib/python` virtualenvwrapper_get_python_version` /site-packages"
298
298
}
299
299
@@ -308,7 +308,7 @@ function virtualenvwrapper_get_site_packages_dir () {
308
308
# "virtualenv_path_extensions.pth" inside the virtualenv's
309
309
# site-packages directory; if this file does not exist, it will be
310
310
# created first.
311
- function add2virtualenv () {
311
+ add2virtualenv () {
312
312
313
313
virtualenvwrapper_verify_workon_home || return 1
314
314
virtualenvwrapper_verify_active_environment || return 1
@@ -350,23 +350,23 @@ function add2virtualenv () {
350
350
351
351
# Does a ``cd`` to the site-packages directory of the currently-active
352
352
# virtualenv.
353
- function cdsitepackages () {
353
+ cdsitepackages () {
354
354
virtualenvwrapper_verify_workon_home || return 1
355
355
virtualenvwrapper_verify_active_environment || return 1
356
356
site_packages=" ` virtualenvwrapper_get_site_packages_dir` "
357
357
cd " $site_packages " /$1
358
358
}
359
359
360
360
# Does a ``cd`` to the root of the currently-active virtualenv.
361
- function cdvirtualenv () {
361
+ cdvirtualenv () {
362
362
virtualenvwrapper_verify_workon_home || return 1
363
363
virtualenvwrapper_verify_active_environment || return 1
364
364
cd $VIRTUAL_ENV /$1
365
365
}
366
366
367
367
# Shows the content of the site-packages directory of the currently-active
368
368
# virtualenv
369
- function lssitepackages () {
369
+ lssitepackages () {
370
370
virtualenvwrapper_verify_workon_home || return 1
371
371
virtualenvwrapper_verify_active_environment || return 1
372
372
site_packages=" ` virtualenvwrapper_get_site_packages_dir` "
@@ -382,7 +382,7 @@ function lssitepackages () {
382
382
}
383
383
384
384
# Duplicate the named virtualenv to make a new one.
385
- function cpvirtualenv() {
385
+ cpvirtualenv () {
386
386
387
387
typeset env_name=" $1 "
388
388
if [ " $env_name " = " " ]
0 commit comments