mirror of
https://github.com/pyenv/pyenv-virtualenv.git
synced 2025-11-12 05:23:53 -05:00
install setuptools and pip into pyvenv
This commit is contained in:
@@ -67,6 +67,38 @@ abs_dirname() {
|
|||||||
cd "$cwd"
|
cd "$cwd"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
http() {
|
||||||
|
local method="$1"
|
||||||
|
local url="$2"
|
||||||
|
local file="$3"
|
||||||
|
[ -n "$url" ] || return 1
|
||||||
|
|
||||||
|
if type curl &>/dev/null; then
|
||||||
|
"http_${method}_curl" "$url" "$file"
|
||||||
|
elif type wget &>/dev/null; then
|
||||||
|
"http_${method}_wget" "$url" "$file"
|
||||||
|
else
|
||||||
|
echo "error: please install \`curl\` or \`wget\` and try again" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
http_head_curl() {
|
||||||
|
curl -qsILf "$1" >&4 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
http_get_curl() {
|
||||||
|
curl -C - -o "${2:--}" -qsSLf "$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
http_head_wget() {
|
||||||
|
wget -q --spider "$1" >&4 2>&1
|
||||||
|
}
|
||||||
|
|
||||||
|
http_get_wget() {
|
||||||
|
wget -nv -c -O "${2:--}" "$1"
|
||||||
|
}
|
||||||
|
|
||||||
version() {
|
version() {
|
||||||
local version="$(virtualenv --version 2>/dev/null || true)"
|
local version="$(virtualenv --version 2>/dev/null || true)"
|
||||||
echo "pyenv-virtualenv ${PYENV_VIRTUALENV_VERSION} (virtualenv ${version:-unknown})"
|
echo "pyenv-virtualenv ${PYENV_VIRTUALENV_VERSION} (virtualenv ${version:-unknown})"
|
||||||
@@ -260,6 +292,16 @@ if [ ! -e "${VIRTUALENV_PATH}/bin/python" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if virtualenv_is_pyvenv; then
|
||||||
|
PYENV_VERSION="${VIRTUALENV_NAME}" pyenv-exec python -c 'import setuptools' 1>/dev/null 2>&1 || {
|
||||||
|
http get "https://bitbucket.org/pypa/setuptools/raw/0.7.4/ez_setup.py" | PYENV_VERSION="${VIRTUALENV_NAME}" pyenv-exec python
|
||||||
|
}
|
||||||
|
|
||||||
|
PYENV_VERSION="${VIRTUALENV_NAME}" pyenv-which pip 1>/dev/null 2>&1 || {
|
||||||
|
http get "https://raw.github.com/pypa/pip/master/contrib/get-pip.py" | PYENV_VERSION="${VIRTUALENV_NAME}" pyenv-exec python
|
||||||
|
}
|
||||||
|
fi
|
||||||
|
|
||||||
## Migrate previously installed packages from requirements.txt
|
## Migrate previously installed packages from requirements.txt
|
||||||
if [ -n "$UPGRADE" ]; then
|
if [ -n "$UPGRADE" ]; then
|
||||||
UPGRADE_STATUS=0
|
UPGRADE_STATUS=0
|
||||||
|
|||||||
Reference in New Issue
Block a user