Browse code

Merge "Use python3 pip module instead of pip binary"

Zuul authored on 2020/06/24 06:33:20
Showing 4 changed files
... ...
@@ -27,6 +27,7 @@ openssl
27 27
 pkg-config
28 28
 psmisc
29 29
 python3-dev
30
+python3-pip
30 31
 python3-venv
31 32
 tar
32 33
 tcpdump
... ...
@@ -24,6 +24,7 @@ pkgconfig
24 24
 postgresql-devel  # psycopg2
25 25
 psmisc
26 26
 python3-devel
27
+python3-pip
27 28
 redhat-rpm-config # missing dep for gcc hardening flags, see rhbz#1217376
28 29
 systemd-devel # for systemd-python
29 30
 tar
... ...
@@ -174,7 +174,7 @@ function pip_install {
174 174
         if python3_enabled; then
175 175
             echo "Using python $PYTHON3_VERSION to install $package_dir because python3_enabled=True"
176 176
             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"
178 178
         else
179 179
             echo "Using python $PYTHON2_VERSION to install $package_dir because python3_enabled=False"
180 180
             cmd_pip=$(get_pip_command $PYTHON2_VERSION)
... ...
@@ -217,7 +217,7 @@ function pip_uninstall {
217 217
         local sudo_pip="sudo -H"
218 218
         if python3_enabled; then
219 219
             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"
221 221
         else
222 222
             cmd_pip=$(get_pip_command $PYTHON2_VERSION)
223 223
         fi
... ...
@@ -5,7 +5,7 @@
5 5
 # Update pip and friends to a known common version
6 6
 
7 7
 # Assumptions:
8
-# - if USE_PYTHON3=True, PYTHON3_VERSION refers to a version already installed
8
+# - PYTHON3_VERSION refers to a version already installed
9 9
 
10 10
 set -o errexit
11 11
 
... ...
@@ -53,6 +53,8 @@ function get_versions {
53 53
     else
54 54
         echo "pip: Not Installed"
55 55
     fi
56
+    # Show python3 module version
57
+    python${PYTHON3_VERSION} -m pip --version
56 58
 }
57 59
 
58 60
 
... ...
@@ -125,7 +127,14 @@ function configure_pypi_alternative_url {
125 125
 # Show starting versions
126 126
 get_versions
127 127
 
128
-# Do pip
128
+if [[ -n $PYPI_ALTERNATIVE_URL ]]; then
129
+    configure_pypi_alternative_url
130
+fi
131
+
132
+# Just use system pkgs on Focal
133
+if [[ "$DISTRO" == focal ]]; then
134
+    exit 0
135
+fi
129 136
 
130 137
 # Eradicate any and all system packages
131 138
 
... ...
@@ -143,10 +152,6 @@ fi
143 143
 
144 144
 install_get_pip
145 145
 
146
-if [[ -n $PYPI_ALTERNATIVE_URL ]]; then
147
-    configure_pypi_alternative_url
148
-fi
149
-
150 146
 set -x
151 147
 
152 148
 # Note setuptools is part of requirements.txt and we want to make sure