#!/bin/bash
# virtualenv - Python virtualenv support
set -e
ve_dir() {
local dir="${1:-.}"
echo "$dir/.venv"
}
ve_activate_script() {
local dir="${1:-.}"
echo "$(ve_dir $dir)/bin/activate"
}
ve_activate() {
if is_function deactivate; then
debug "ve_activate: skipped"
return
fi
# find activation script or create it
local dir=${1:-.}
local activate="$(ve_activate_script "$dir")"
[ -f "$activate" ] || ve_create "$dir"
# load the activation script in this shell
debug "ve_activate: running \"$activate\""
source "$activate"
}
ve_create() {
local vdir
vdir=$(ve_dir $1)
if [ -d "$vdir" ]; then
debug "ve_create: '$vdir' exists"
else
ve_update "$@"
fi
}
ve_update() {
run virtualenv "$(ve_dir $1)"
}
ve_delete() {
local vdir
vdir="$(ve_dir $1)"
if [ -d "$vdir" ]; then
run rm -r "$vdir"
else
debug "ve_delete: '$vdir' does not exist"
fi
}
ve_install() {
for i in "$@"; do
run easy_install "$i"
done
}
Generated on Thu May 4 19:00:37 PDT 2017 by mcsh i7 v0.19.0.