From 5182388b7c24773c6d15dc98b9851e0f5bb52178 Mon Sep 17 00:00:00 2001 From: Riccardo Pittau Date: Mon, 25 May 2020 10:20:32 +0200 Subject: [PATCH] Fix pip3 path The pip3 binary can be in a different location from python3. Change-Id: I19f32c0a8316dc0fca452b7e8d36c777effcbeb5 Story: 2007694 Task: 39806 --- scripts/env-setup.sh | 2 +- scripts/install-deps.sh | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/env-setup.sh b/scripts/env-setup.sh index aa1d76fda..030295149 100755 --- a/scripts/env-setup.sh +++ b/scripts/env-setup.sh @@ -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}" diff --git a/scripts/install-deps.sh b/scripts/install-deps.sh index d5fd75e7e..ffcd874cc 100644 --- a/scripts/install-deps.sh +++ b/scripts/install-deps.sh @@ -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