Skip to content

Commit a4369c8

Browse files
ralonsohosfrickler
authored andcommitted
Add python3.6 pip support
Since pip v22, python3.6 is not supported (the minimum version is python3.7). This patch adds the reference for the pip3.6 URL to be used instead of the default one. Conflicts: tools/install_pip.sh Closes-Bug: #1959600 Change-Id: Iab2c391d5388461fe9e9037cee81884ce8032e72 (cherry picked from commit a756f4b) (cherry picked from commit 13da39f)
1 parent e6a4824 commit a4369c8

File tree

1 file changed

+20
-11
lines changed

1 file changed

+20
-11
lines changed

tools/install_pip.sh

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ FILES=$TOP_DIR/files
3838
# [1] https://opendev.org/openstack/project-config/src/branch/master/nodepool/elements/cache-devstack/source-repository-pip
3939

4040
PIP_GET_PIP_URL=${PIP_GET_PIP_URL:-"https://bootstrap.pypa.io/get-pip.py"}
41-
LOCAL_PIP="$FILES/$(basename $PIP_GET_PIP_URL)"
41+
PIP_GET_PIP36_URL=${PIP_GET_PIP36_URL:-"https://bootstrap.pypa.io/pip/3.6/get-pip.py"}
4242

4343
GetDistro
4444
echo "Distro: $DISTRO"
@@ -59,12 +59,21 @@ function get_versions {
5959

6060

6161
function install_get_pip {
62+
if [[ "$PYTHON3_VERSION" = "3.6" ]]; then
63+
_pip_url=$PIP_GET_PIP36_URL
64+
_local_pip="$FILES/$(basename $_pip_url)-py36"
65+
else
66+
_pip_url=$PIP_GET_PIP_URL
67+
_local_pip="$FILES/$(basename $_pip_url)"
68+
fi
69+
70+
6271
# If get-pip.py isn't python, delete it. This was probably an
6372
# outage on the server.
64-
if [[ -r $LOCAL_PIP ]]; then
65-
if ! head -1 $LOCAL_PIP | grep -q '#!/usr/bin/env python'; then
66-
echo "WARNING: Corrupt $LOCAL_PIP found removing"
67-
rm $LOCAL_PIP
73+
if [[ -r $_local_pip ]]; then
74+
if ! head -1 $_local_pip | grep -q '#!/usr/bin/env python'; then
75+
echo "WARNING: Corrupt $_local_pip found removing"
76+
rm $_local_pip
6877
fi
6978
fi
7079

@@ -78,22 +87,22 @@ function install_get_pip {
7887
# Thus we use curl's "-z" feature to always check the modified
7988
# since and only download if a new version is out -- but only if
8089
# it seems we downloaded the file originally.
81-
if [[ ! -r $LOCAL_PIP || -r $LOCAL_PIP.downloaded ]]; then
90+
if [[ ! -r $_local_pip || -r $_local_pip.downloaded ]]; then
8291
# only test freshness if LOCAL_PIP is actually there,
8392
# otherwise we generate a scary warning.
8493
local timecond=""
85-
if [[ -r $LOCAL_PIP ]]; then
86-
timecond="-z $LOCAL_PIP"
94+
if [[ -r $_local_pip ]]; then
95+
timecond="-z $_local_pip"
8796
fi
8897

8998
curl -f --retry 6 --retry-delay 5 \
90-
$timecond -o $LOCAL_PIP $PIP_GET_PIP_URL || \
99+
$timecond -o $_local_pip $_pip_url || \
91100
die $LINENO "Download of get-pip.py failed"
92-
touch $LOCAL_PIP.downloaded
101+
touch $_local_pip.downloaded
93102
fi
94103
# TODO: remove the trailing pip constraint when a proper fix
95104
# arrives for bug https://bugs.launchpad.net/devstack/+bug/1906322
96-
sudo -H -E python${PYTHON3_VERSION} $LOCAL_PIP -c $TOOLS_DIR/cap-pip.txt
105+
sudo -H -E python${PYTHON3_VERSION} $_local_pip -c $TOOLS_DIR/cap-pip.txt
97106
}
98107

99108

0 commit comments

Comments
 (0)