Revert "Dont install python-pip for py3k"

This reverts commit ab89c7d69c.

This commit checked for DIB_PYTHON_VERSION and only installed the v3
packages.  This is unfortunately backwards-incompatible, as consumers
such as the openstack gate are relying on this package installing pip
& virtualenv packages for python2 AND python3.

This was sort-of expressed in the docs, where it discusses what the
resulting setup of the system will be, but I've added a note to make
it clearer.

If we want to change this, I think we'll need either a new element, or
a non-defaulting flag.

Change-Id: I419dbdf4682394db68974944af1e5c432f3e0565
This commit is contained in:
Ian Wienand 2018-01-10 15:43:45 +11:00
parent acc44c0651
commit e9df83b2b3
2 changed files with 9 additions and 8 deletions

View File

@ -4,6 +4,10 @@ pip-and-virtualenv
This element installs pip and virtualenv in the image. This element installs pip and virtualenv in the image.
.. note:: This element setups and Python 2 and Python 3 environment.
This means it will bring in python2 packages, so isn't
appropriate if you want a python3 only environment.
Package install Package install
=============== ===============

View File

@ -115,7 +115,7 @@ else
# time and you had to use "python -m venv". Since then virtualenv # time and you had to use "python -m venv". Since then virtualenv
# has gained 3.4 support so the pip install below will work # has gained 3.4 support so the pip install below will work
if [[ ${DIB_PYTHON_VERSION} == 3 ]]; then if [[ ${DIB_PYTHON_VERSION} == 3 ]]; then
packages=$(echo "$packages" | sed s/python-virtualenv/python3-virtualenv/ | sed s/python-pip/python3-pip/) packages=$(echo "$packages" | sed s/python-virtualenv/python3-virtualenv/)
fi fi
apt-get -y install $packages apt-get -y install $packages
@ -126,12 +126,9 @@ else
# These install into /usr/local/bin so override any packages, even # These install into /usr/local/bin so override any packages, even
# if installed later. # if installed later.
if [[ ${DIB_PYTHON_VERSION} == 3 ]]; then
python3 /tmp/get-pip.py $pip_args python3 /tmp/get-pip.py $pip_args
pip3 install $pip_args virtualenv
else
python2 /tmp/get-pip.py $pip_args python2 /tmp/get-pip.py $pip_args
pip3 install $pip_args virtualenv
pip install $pip_args virtualenv pip install $pip_args virtualenv
fi fi
fi