install_pip: Use packaged pip on Fedora
This uses the python3-pip package for Fedora but maintains the status
quo for existing distributions (i.e. for Suse we run get-pip.py but
don't uninstall, and for everything else we uninstall python3-pip and
run get-pip.py to be running the latest pip).
As noted inline, installing get-pip.py over Fedora 34's package no
longer works, and likely won't ever work again. Unlike the LTS
distributions, the Fedora pip should be more up-to-date, so I think
it's best we just avoid any package overwrites.
Change-Id: I84129aadfcf585bb150a3daa39616246d3d84bbd
diff --git a/tools/install_pip.sh b/tools/install_pip.sh
index eb0f6eb..7ecea4e 100755
--- a/tools/install_pip.sh
+++ b/tools/install_pip.sh
@@ -126,19 +126,31 @@
configure_pypi_alternative_url
fi
-# Eradicate any and all system packages
-
-# Python in fedora/suse depends on the python-pip package so removing it
-# results in a nonfunctional system. pip on fedora installs to /usr so pip
-# can safely override the system pip for all versions of fedora
-if ! is_fedora && ! is_suse; then
+if is_fedora && [[ ${DISTRO} == f* ]]; then
+ # get-pip.py will not install over the python3-pip package in
+ # Fedora 34 any more.
+ # https://bugzilla.redhat.com/show_bug.cgi?id=1988935
+ # https://github.com/pypa/pip/issues/9904
+ # You can still install using get-pip.py if python3-pip is *not*
+ # installed; this *should* remain separate under /usr/local and not break
+ # if python3-pip is later installed.
+ # For general sanity, we just use the packaged pip. It should be
+ # recent enough anyway.
+ install_package python3-pip
+elif is_fedora || is_suse; then
+ # Python in suse/centos depends on the python-pip package; because
+ # of the split "system-python" uninstalling python3-pip also
+ # uninstalls the user python3 package which is bad and leaves us
+ # without a python to use. Just install over.
+ install_get_pip
+else
+ # Remove packaged pip, and install the latest upstream.
if is_package_installed python3-pip ; then
uninstall_package python3-pip
fi
+ install_get_pip
fi
-install_get_pip
-
set -x
# Note setuptools is part of requirements.txt and we want to make sure