Use python3 pip module instead of pip binary

Focal only provides a pip3 binary, no pip3.8. Instead of working around
that with a symlink, use the module instead.

Add version information output for this variant.

Change-Id: I7af194ecc40e4d43c10ce067a661bb6ab4ca37d4
This commit is contained in:
Jens Harbott 2020-06-11 05:51:26 +00:00
parent c2c2b6b415
commit f1ed7c77c5
4 changed files with 15 additions and 8 deletions

View File

@ -27,6 +27,7 @@ openssl
pkg-config pkg-config
psmisc psmisc
python3-dev python3-dev
python3-pip
python3-venv python3-venv
tar tar
tcpdump tcpdump

View File

@ -24,6 +24,7 @@ pkgconfig
postgresql-devel # psycopg2 postgresql-devel # psycopg2
psmisc psmisc
python3-devel python3-devel
python3-pip
redhat-rpm-config # missing dep for gcc hardening flags, see rhbz#1217376 redhat-rpm-config # missing dep for gcc hardening flags, see rhbz#1217376
systemd-devel # for systemd-python systemd-devel # for systemd-python
tar tar

View File

@ -174,7 +174,7 @@ function pip_install {
if python3_enabled; then if python3_enabled; then
echo "Using python $PYTHON3_VERSION to install $package_dir because python3_enabled=True" echo "Using python $PYTHON3_VERSION to install $package_dir because python3_enabled=True"
sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8" sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8"
cmd_pip=$(get_pip_command $PYTHON3_VERSION) cmd_pip="python$PYTHON3_VERSION -m pip"
else else
echo "Using python $PYTHON2_VERSION to install $package_dir because python3_enabled=False" echo "Using python $PYTHON2_VERSION to install $package_dir because python3_enabled=False"
cmd_pip=$(get_pip_command $PYTHON2_VERSION) cmd_pip=$(get_pip_command $PYTHON2_VERSION)
@ -217,7 +217,7 @@ function pip_uninstall {
local sudo_pip="sudo -H" local sudo_pip="sudo -H"
if python3_enabled; then if python3_enabled; then
sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8" sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8"
cmd_pip=$(get_pip_command $PYTHON3_VERSION) cmd_pip="python$PYTHON3_VERSION -m pip"
else else
cmd_pip=$(get_pip_command $PYTHON2_VERSION) cmd_pip=$(get_pip_command $PYTHON2_VERSION)
fi fi

View File

@ -5,7 +5,7 @@
# Update pip and friends to a known common version # Update pip and friends to a known common version
# Assumptions: # Assumptions:
# - if USE_PYTHON3=True, PYTHON3_VERSION refers to a version already installed # - PYTHON3_VERSION refers to a version already installed
set -o errexit set -o errexit
@ -53,6 +53,8 @@ function get_versions {
else else
echo "pip: Not Installed" echo "pip: Not Installed"
fi fi
# Show python3 module version
python${PYTHON3_VERSION} -m pip --version
} }
@ -125,7 +127,14 @@ function configure_pypi_alternative_url {
# Show starting versions # Show starting versions
get_versions get_versions
# Do pip if [[ -n $PYPI_ALTERNATIVE_URL ]]; then
configure_pypi_alternative_url
fi
# Just use system pkgs on Focal
if [[ "$DISTRO" == focal ]]; then
exit 0
fi
# Eradicate any and all system packages # Eradicate any and all system packages
@ -143,10 +152,6 @@ fi
install_get_pip install_get_pip
if [[ -n $PYPI_ALTERNATIVE_URL ]]; then
configure_pypi_alternative_url
fi
set -x set -x
# Note setuptools is part of requirements.txt and we want to make sure # Note setuptools is part of requirements.txt and we want to make sure