forked from havenwood/pants
-
Notifications
You must be signed in to change notification settings - Fork 0
/
virtualenv
executable file
·36 lines (30 loc) · 1.22 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
#!/usr/bin/env bash
# Wrapper for self-bootstrapping virtualenv
set -e
VIRTUALENV_VERSION=1.11.4
VIRTUALENV_PACKAGE_LOCATION=${VIRTUALENV_PACKAGE_LOCATION:-https://pypi.python.org/packages/source/v/virtualenv}
REPO_ROOT=$(cd $(dirname "${BASH_SOURCE[0]}") && cd "$(git rev-parse --show-toplevel)" && pwd)
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)
BOOTSTRAP_FILE=${HERE}/virtualenv-${VIRTUALENV_VERSION}/BOOTSTRAPPED
if ! [ -f "${BOOTSTRAP_FILE}" ]; then
pushd "${HERE}"
VIRTUALENV_PACKAGE_FULL_URL=${VIRTUALENV_PACKAGE_LOCATION}/virtualenv-${VIRTUALENV_VERSION}.tar.gz
log "Downloading ${VIRTUALENV_PACKAGE_FULL_URL}..."
curl -O ${VIRTUALENV_PACKAGE_FULL_URL} || \
die "Failed to download ${VIRTUALENV_PACKAGE_FULL_URL}."
tar zxvf virtualenv-${VIRTUALENV_VERSION}.tar.gz || \
die "Failed to extract ${VIRTUALENV_PACKAGE_FULL_URL}."
# TODO(ksweeney): Checksum
touch ${BOOTSTRAP_FILE} # 2PC
popd
fi
exec "${PY}" "${HERE}/virtualenv-${VIRTUALENV_VERSION}/virtualenv.py" "$@"