-
Notifications
You must be signed in to change notification settings - Fork 0
/
activate
25 lines (23 loc) · 1.02 KB
/
activate
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[ -n "$BASH_SOURCE" ] \
|| { echo 1>&2 "source (.) this with Bash."; exit 2; }
__activate_quiet=
[[ $1 = -q ]] && { shift; __activate_quiet=-q; }
(
basedir=$(cd "$(dirname "$BASH_SOURCE")" && pwd -P)
cd "$basedir"
[ -d .build/virtualenv ] || {
py='python3'; $py -m pip --version >/dev/null 2>&1 || py='python'
echo 'Bootstrapping virtualenv'
bsdir=".build/virtualenv-bootstrap"
deb_nouser=--system # Must turn off --user on Debian
$py -m pip install $deb_nouser >/dev/null 2>&1 || deb_nouser=
$py -m pip $__activate_quiet $__activate_quiet install $deb_nouser \
-b "$bsdir/build" -t "$bsdir/target" virtualenv
echo 'Building virtualenv...'
$py $bsdir/target/virtualenv.py --prompt="($(basename "$basedir")) " \
$__activate_quiet .build/virtualenv "$@" \
&& . .build/virtualenv/*/activate \
&& pip install $__activate_quiet -r requirements.txt
}
) \
&& . "$(dirname "$BASH_SOURCE")"/.build/virtualenv/*/activate