Merge "Teach pip_install() about virtual envs"

This commit is contained in:
Jenkins 2015-02-18 20:59:20 +00:00 committed by Gerrit Code Review
commit a6de7e962c
1 changed files with 17 additions and 4 deletions

View File

@ -31,6 +31,13 @@ function get_pip_command {
# Get the path to the direcotry where python executables are installed.
# get_python_exec_prefix
function get_python_exec_prefix {
local xtrace=$(set +o | grep xtrace)
set +o xtrace
if [[ -z "$os_PACKAGE" ]]; then
GetOSVersion
fi
$xtrace
if is_fedora || is_suse; then
echo "/usr/bin"
else
@ -39,8 +46,8 @@ function get_python_exec_prefix {
}
# Wrapper for ``pip install`` to set cache and proxy environment variables
# Uses globals ``INSTALL_TESTONLY_PACKAGES``, ``OFFLINE``, ``TRACK_DEPENDS``,
# ``*_proxy``
# Uses globals ``INSTALL_TESTONLY_PACKAGES``, ``OFFLINE``, ``PIP_VIRTUAL_ENV``,
# ``TRACK_DEPENDS``, ``*_proxy``
# pip_install package [package ...]
function pip_install {
local xtrace=$(set +o | grep xtrace)
@ -62,8 +69,13 @@ function pip_install {
local cmd_pip=$DEST/.venv/bin/pip
local sudo_pip="env"
else
local cmd_pip=$(get_pip_command)
local sudo_pip="sudo -H"
if [[ -n ${PIP_VIRTUAL_ENV:=} && -d ${PIP_VIRTUAL_ENV} ]]; then
local cmd_pip=$PIP_VIRTUAL_ENV/bin/pip
local sudo_pip="env"
else
local cmd_pip=$(get_pip_command)
local sudo_pip="sudo -H"
fi
fi
local pip_version=$(python -c "import pip; \
@ -93,6 +105,7 @@ function pip_install {
-r $test_req
fi
fi
$xtrace
}
# get version of a package from global requirements file