forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvirtualenv
executable file
·42 lines (36 loc) · 1.39 KB
/
virtualenv
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env bash
# Wrapper for self-bootstrapping virtualenv
set -e
VIRTUALENV_VERSION=15.0.2
VIRTUALENV_PACKAGE_LOCATION=${VIRTUALENV_PACKAGE_LOCATION:-https://pypi.io/packages/source/v/virtualenv}
if [[ $GIT_HOOK == 1 ]] ; then
REPO_ROOT=.
else
REPO_ROOT=$(cd $(dirname "${BASH_SOURCE[0]}") && git rev-parse --show-toplevel)
fi
source ${REPO_ROOT}/build-support/common.sh
if [[ -z "${PY}" ]]; then
if which python2.7 >/dev/null; then
PY=`which python2.7`
else
die 'No python2.7 interpreter found on the path. Python will not work!'
fi
fi
log "Using ${PY}"
HERE=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd)
if ! [ -f "${HERE}/virtualenv.dist/BOOTSTRAPPED-${VIRTUALENV_VERSION}" ]; then
pushd "${HERE}"
VIRTUALENV_PACKAGE_FULL_URL=${VIRTUALENV_PACKAGE_LOCATION}/virtualenv-${VIRTUALENV_VERSION}.tar.gz
log "Downloading ${VIRTUALENV_PACKAGE_FULL_URL}..."
curl -L -O ${VIRTUALENV_PACKAGE_FULL_URL} || \
die "Failed to download ${VIRTUALENV_PACKAGE_FULL_URL}."
rm -rf virtualenv-${VIRTUALENV_VERSION} && \
tar zxvf virtualenv-${VIRTUALENV_VERSION}.tar.gz || \
die "Failed to extract ${VIRTUALENV_PACKAGE_FULL_URL}."
# TODO(ksweeney): Checksum
touch virtualenv-${VIRTUALENV_VERSION}/BOOTSTRAPPED-${VIRTUALENV_VERSION} && \
rm -rf virtualenv.dist && \
mv -v virtualenv-${VIRTUALENV_VERSION} virtualenv.dist
popd
fi
exec "${PY}" "${HERE}/virtualenv.dist/virtualenv.py" "$@"