From 4db9d567d19759ee090e506adf7ad77d8e64e452 Mon Sep 17 00:00:00 2001 From: Tom Barron Date: Wed, 9 Jan 2019 08:43:52 -0500 Subject: [PATCH] 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 --- inc/python | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/inc/python b/inc/python index 19e1228d23..0e575ae9e9 100644 --- a/inc/python +++ b/inc/python @@ -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