Safety check for python version in get_pip_command

We know empirically that some legacy gate jobs pass and appear
to be running with python3 but actually pip was invoked with
PYTHON3_VERSION unset so that they are actually ran with python2
packages.

As a followup to this discussion [1], add a safety check in the
get_pip_command function to ensure that a python version has been
set when it is invoked.

[1] https://review.openstack.org/#/c/622415/4/inc/python@283

Change-Id: I3a08406fb7d68282c6b98abb33a625821510046a
This commit is contained in:
Tom Barron 2019-01-09 08:43:52 -05:00 committed by garyk
parent 172f02f1e0
commit 4db9d567d1
1 changed files with 4 additions and 0 deletions

View File

@ -29,6 +29,10 @@ declare -A -g PROJECT_VENV
# get_pip_command
function get_pip_command {
local version="$1"
if [ -z "$version" ]; then
die $LINENO "pip python version is not set."
fi
# NOTE(dhellmann): I don't know if we actually get a pip3.4-python
# under any circumstances.
which pip${version} || which pip${version}-python