Skip to content

Commit f1ed7c7

Browse files
committed
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
1 parent c2c2b6b commit f1ed7c7

File tree

4 files changed

+15
-8
lines changed

4 files changed

+15
-8
lines changed

files/debs/general

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ openssl
2727
pkg-config
2828
psmisc
2929
python3-dev
30+
python3-pip
3031
python3-venv
3132
tar
3233
tcpdump

files/rpms/general

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ pkgconfig
2424
postgresql-devel # psycopg2
2525
psmisc
2626
python3-devel
27+
python3-pip
2728
redhat-rpm-config # missing dep for gcc hardening flags, see rhbz#1217376
2829
systemd-devel # for systemd-python
2930
tar

inc/python

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ function pip_install {
174174
if python3_enabled; then
175175
echo "Using python $PYTHON3_VERSION to install $package_dir because python3_enabled=True"
176176
sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8"
177-
cmd_pip=$(get_pip_command $PYTHON3_VERSION)
177+
cmd_pip="python$PYTHON3_VERSION -m pip"
178178
else
179179
echo "Using python $PYTHON2_VERSION to install $package_dir because python3_enabled=False"
180180
cmd_pip=$(get_pip_command $PYTHON2_VERSION)
@@ -217,7 +217,7 @@ function pip_uninstall {
217217
local sudo_pip="sudo -H"
218218
if python3_enabled; then
219219
sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8"
220-
cmd_pip=$(get_pip_command $PYTHON3_VERSION)
220+
cmd_pip="python$PYTHON3_VERSION -m pip"
221221
else
222222
cmd_pip=$(get_pip_command $PYTHON2_VERSION)
223223
fi

tools/install_pip.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Update pip and friends to a known common version
66

77
# Assumptions:
8-
# - if USE_PYTHON3=True, PYTHON3_VERSION refers to a version already installed
8+
# - PYTHON3_VERSION refers to a version already installed
99

1010
set -o errexit
1111

@@ -53,6 +53,8 @@ function get_versions {
5353
else
5454
echo "pip: Not Installed"
5555
fi
56+
# Show python3 module version
57+
python${PYTHON3_VERSION} -m pip --version
5658
}
5759

5860

@@ -125,7 +127,14 @@ function configure_pypi_alternative_url {
125127
# Show starting versions
126128
get_versions
127129

128-
# Do pip
130+
if [[ -n $PYPI_ALTERNATIVE_URL ]]; then
131+
configure_pypi_alternative_url
132+
fi
133+
134+
# Just use system pkgs on Focal
135+
if [[ "$DISTRO" == focal ]]; then
136+
exit 0
137+
fi
129138

130139
# Eradicate any and all system packages
131140

@@ -143,10 +152,6 @@ fi
143152

144153
install_get_pip
145154

146-
if [[ -n $PYPI_ALTERNATIVE_URL ]]; then
147-
configure_pypi_alternative_url
148-
fi
149-
150155
set -x
151156

152157
# Note setuptools is part of requirements.txt and we want to make sure

0 commit comments

Comments
 (0)