Do not try finding pip for python2 when not required
[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] 279a7589b0
[2] http://lists.openstack.org/pipermail/openstack-discuss/2020-January/012182.html
Change-Id: I36ee53e57e468d760b80a7e621b90899867a8efd
This commit is contained in:
parent
f9a6986b90
commit
29bf852396
27
inc/python
27
inc/python
@ -162,16 +162,14 @@ function pip_install {
|
|||||||
local sudo_pip="env"
|
local sudo_pip="env"
|
||||||
else
|
else
|
||||||
local cmd_pip
|
local cmd_pip
|
||||||
cmd_pip=$(get_pip_command $PYTHON2_VERSION)
|
|
||||||
local sudo_pip="sudo -H"
|
local sudo_pip="sudo -H"
|
||||||
if python3_enabled; then
|
if python3_enabled; then
|
||||||
# Special case some services that have experimental
|
echo "Using python $PYTHON3_VERSION to install $package_dir because python3_enabled=True"
|
||||||
# support for python3 in progress, but don't claim support
|
|
||||||
# in their classifier
|
|
||||||
echo "Check python version for : $package_dir"
|
|
||||||
echo "Using $PYTHON3_VERSION version to install $package_dir based on default behavior"
|
|
||||||
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=$(get_pip_command $PYTHON3_VERSION)
|
||||||
|
else
|
||||||
|
echo "Using python $PYTHON2_VERSION to install $package_dir because python3_enabled=False"
|
||||||
|
cmd_pip=$(get_pip_command $PYTHON2_VERSION)
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -179,16 +177,6 @@ function pip_install {
|
|||||||
# Always apply constraints
|
# Always apply constraints
|
||||||
cmd_pip="$cmd_pip -c $REQUIREMENTS_DIR/upper-constraints.txt"
|
cmd_pip="$cmd_pip -c $REQUIREMENTS_DIR/upper-constraints.txt"
|
||||||
|
|
||||||
# FIXME(dhellmann): Need to force multiple versions of pip for
|
|
||||||
# packages like setuptools?
|
|
||||||
local pip_version
|
|
||||||
pip_version=$(python -c "import pip; \
|
|
||||||
print(pip.__version__.split('.')[0])")
|
|
||||||
if (( pip_version<6 )); then
|
|
||||||
die $LINENO "Currently installed pip version ${pip_version} does not" \
|
|
||||||
"meet minimum requirements (>=6)."
|
|
||||||
fi
|
|
||||||
|
|
||||||
$xtrace
|
$xtrace
|
||||||
|
|
||||||
# Also install test requirements
|
# Also install test requirements
|
||||||
@ -225,8 +213,13 @@ function pip_uninstall {
|
|||||||
local sudo_pip="env"
|
local sudo_pip="env"
|
||||||
else
|
else
|
||||||
local cmd_pip
|
local cmd_pip
|
||||||
cmd_pip=$(get_pip_command $PYTHON2_VERSION)
|
|
||||||
local sudo_pip="sudo -H"
|
local sudo_pip="sudo -H"
|
||||||
|
if python3_enabled; then
|
||||||
|
sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8"
|
||||||
|
cmd_pip=$(get_pip_command $PYTHON3_VERSION)
|
||||||
|
else
|
||||||
|
cmd_pip=$(get_pip_command $PYTHON2_VERSION)
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
# don't error if we can't uninstall, it might not be there
|
# don't error if we can't uninstall, it might not be there
|
||||||
$sudo_pip $cmd_pip uninstall -y $name || /bin/true
|
$sudo_pip $cmd_pip uninstall -y $name || /bin/true
|
||||||
|
Loading…
Reference in New Issue
Block a user