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] 279a7589b03db69fd1b85d947cd0171dacef94ee
[2] http://lists.openstack.org/pipermail/openstack-discuss/2020-January/012182.html
Change-Id: I36ee53e57e468d760b80a7e621b90899867a8efd
diff --git a/inc/python b/inc/python
index 32dd725..37e8399 100644
--- a/inc/python
+++ b/inc/python
@@ -162,16 +162,14 @@
local sudo_pip="env"
else
local cmd_pip
- cmd_pip=$(get_pip_command $PYTHON2_VERSION)
local sudo_pip="sudo -H"
if python3_enabled; then
- # Special case some services that have experimental
- # 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"
+ echo "Using python $PYTHON3_VERSION to install $package_dir because python3_enabled=True"
sudo_pip="$sudo_pip LC_ALL=en_US.UTF-8"
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
@@ -179,16 +177,6 @@
# Always apply constraints
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
# Also install test requirements
@@ -225,8 +213,13 @@
local sudo_pip="env"
else
local cmd_pip
- cmd_pip=$(get_pip_command $PYTHON2_VERSION)
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
# don't error if we can't uninstall, it might not be there
$sudo_pip $cmd_pip uninstall -y $name || /bin/true