Install at least pip version 19.1.1

This is to avoid a known issue with a recent version of cryptography [1]

[1] https://github.com/pyca/cryptography/issues/5771

Change-Id: I034bcd24031b5881ae49b8bc03bed6654cd1d335
This commit is contained in:
Riccardo Pittau 2021-02-09 10:30:24 +01:00
parent ea0015c86e
commit 5360d0e869

View File

@ -8,6 +8,11 @@ fi
declare -A PKG_MAP
# NOTE(rpittau): we need a stable recent version of pip to avoid issues with
# the cryptography package.
PIP_MIN_REQ="19.1.1"
PIP_TUPLE="(19, 1, 1)"
# workaround: for latest bindep to work, it needs to use en_US local
export LANG=en_US.UTF-8
@ -86,7 +91,7 @@ case ${ID,,} in
*) echo "ERROR: Supported package manager not found. Supported: apt, dnf, yum, zypper"; exit 1;;
esac
echo Installing Python and PIP
echo "Installing Python and PIP"
for pkg in ${CHECK_CMD_PKGS[@]}; do
if ! $(${CHECK_CMD} ${PKG_MAP[$pkg]} &>/dev/null); then
@ -133,11 +138,12 @@ if [[ "${BIFROST_TRACE:-}" != true ]]; then
PIP="$PIP --quiet"
fi
$PYTHON << EOF
import pip
version = tuple(map(int, pip.__version__.split('.')))
assert version >= (7, 1)
EOF
# NOTE(rpittau): we need a stable recent version of pip to avoid issues with
# the cryptography package.
PIP_REQUIRED=$($PYTHON -c "import pip; print(tuple(map(int, pip.__version__.split('.'))) >= $PIP_TUPLE)")
if [[ $PIP_REQUIRED == "False" ]]; then
${PIP} install "pip==$PIP_MIN_REQ"
fi
export PIP_OPTS="--upgrade-strategy only-if-needed"