[1] stopped installing pip for py2 when py3 is being used.
This patch makes sure we check only for py3 pip then.
Also removed some no-longer-relevant comment and
made uninstall behave the same.
Check for pip>=6 removed too.
See also [2].
[1] 279a7589b03db69fd1b85d947cd0171dacef94ee
[2] http://lists.openstack.org/pipermail/openstack-discuss/2020-January/012182.html
Change-Id: I36ee53e57e468d760b80a7e621b90899867a8efd
| ... | ... |
@@ -162,16 +162,14 @@ function pip_install {
|
| 162 | 162 |
local sudo_pip="env" |
| 163 | 163 |
else |
| 164 | 164 |
local cmd_pip |
| 165 |
- cmd_pip=$(get_pip_command $PYTHON2_VERSION) |
|
| 166 | 165 |
local sudo_pip="sudo -H" |
| 167 | 166 |
if python3_enabled; then |
| 168 |
- # Special case some services that have experimental |
|
| 169 |
- # support for python3 in progress, but don't claim support |
|
| 170 |
- # in their classifier |
|
| 171 |
- echo "Check python version for : $package_dir" |
|
| 172 |
- echo "Using $PYTHON3_VERSION version to install $package_dir based on default behavior" |
|
| 167 |
+ echo "Using python $PYTHON3_VERSION to install $package_dir because python3_enabled=True" |
|
| 173 | 168 |
sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8" |
| 174 | 169 |
cmd_pip=$(get_pip_command $PYTHON3_VERSION) |
| 170 |
+ else |
|
| 171 |
+ echo "Using python $PYTHON2_VERSION to install $package_dir because python3_enabled=False" |
|
| 172 |
+ cmd_pip=$(get_pip_command $PYTHON2_VERSION) |
|
| 175 | 173 |
fi |
| 176 | 174 |
fi |
| 177 | 175 |
|
| ... | ... |
@@ -179,16 +177,6 @@ function pip_install {
|
| 179 | 179 |
# Always apply constraints |
| 180 | 180 |
cmd_pip="$cmd_pip -c $REQUIREMENTS_DIR/upper-constraints.txt" |
| 181 | 181 |
|
| 182 |
- # FIXME(dhellmann): Need to force multiple versions of pip for |
|
| 183 |
- # packages like setuptools? |
|
| 184 |
- local pip_version |
|
| 185 |
- pip_version=$(python -c "import pip; \ |
|
| 186 |
- print(pip.__version__.split('.')[0])")
|
|
| 187 |
- if (( pip_version<6 )); then |
|
| 188 |
- die $LINENO "Currently installed pip version ${pip_version} does not" \
|
|
| 189 |
- "meet minimum requirements (>=6)." |
|
| 190 |
- fi |
|
| 191 |
- |
|
| 192 | 182 |
$xtrace |
| 193 | 183 |
|
| 194 | 184 |
# Also install test requirements |
| ... | ... |
@@ -225,8 +213,13 @@ function pip_uninstall {
|
| 225 | 225 |
local sudo_pip="env" |
| 226 | 226 |
else |
| 227 | 227 |
local cmd_pip |
| 228 |
- cmd_pip=$(get_pip_command $PYTHON2_VERSION) |
|
| 229 | 228 |
local sudo_pip="sudo -H" |
| 229 |
+ if python3_enabled; then |
|
| 230 |
+ sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8" |
|
| 231 |
+ cmd_pip=$(get_pip_command $PYTHON3_VERSION) |
|
| 232 |
+ else |
|
| 233 |
+ cmd_pip=$(get_pip_command $PYTHON2_VERSION) |
|
| 234 |
+ fi |
|
| 230 | 235 |
fi |
| 231 | 236 |
# don't error if we can't uninstall, it might not be there |
| 232 | 237 |
$sudo_pip $cmd_pip uninstall -y $name || /bin/true |