Fix pip3 path

The pip3 binary can be in a different location from python3.

Change-Id: I19f32c0a8316dc0fca452b7e8d36c777effcbeb5
Story: 2007694
Task: 39806
This commit is contained in:
Riccardo Pittau 2020-05-25 10:20:32 +02:00
parent d75a07ccb2
commit 5182388b7c
2 changed files with 4 additions and 5 deletions

View File

@ -11,7 +11,7 @@ ANSIBLE_PIP_VERSION=${ANSIBLE_PIP_VERSION:-${DEFAULT_PIP_ANSIBLE}}
ANSIBLE_SOURCE_PATH=${ANSIBLE_SOURCE_PATH:-ansible${ANSIBLE_PIP_VERSION}}
if [ -n "${VENV-}" ]; then
sudo -H -E ${PIP} install "${ANSIBLE_SOURCE_PATH}"
${PIP} install "${ANSIBLE_SOURCE_PATH}"
ANSIBLE=${VENV}/bin/ansible
else
${PIP} install --user --upgrade "${ANSIBLE_SOURCE_PATH}"

View File

@ -98,6 +98,7 @@ if [ -n "${VENV-}" ]; then
if [ ! -f ${VENV}/bin/activate ]; then
# only create venv if one doesn't exist
sudo -H -E python3 -m venv --system-site-packages ${VENV}
sudo -H -E chown -R ${USER} ${VENV}
fi
# Note(cinerama): activate is not compatible with "set -u";
# disable it just for this line.
@ -111,9 +112,9 @@ fi
# If we're using a venv, we need to work around sudo not
# keeping the path even with -E.
PYTHON=$(which python3)
PYTHON="python3"
PIP="${PYTHON} -m pip"
ls $PYTHON
$PYTHON << EOF
import pip
version = tuple(map(int, pip.__version__.split('.')))
@ -126,8 +127,6 @@ if [ -n "${VENV-}" ]; then
ls -la ${VENV}/bin
fi
PIP=$(echo $PYTHON | sed 's/python/pip/')
# Install the rest of required packages using bindep
sudo -H -E ${PIP} install bindep