From e9df83b2b3e61dc354402ad5bd1cea6563ef7e20 Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Wed, 10 Jan 2018 15:43:45 +1100 Subject: [PATCH] Revert "Dont install python-pip for py3k" This reverts commit ab89c7d69c6bba6a6e394ff7a4ae520268bb2b16. 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 --- .../elements/pip-and-virtualenv/README.rst | 4 ++++ .../04-install-pip | 13 +++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/diskimage_builder/elements/pip-and-virtualenv/README.rst b/diskimage_builder/elements/pip-and-virtualenv/README.rst index bf79ff2f6..e056a2163 100644 --- a/diskimage_builder/elements/pip-and-virtualenv/README.rst +++ b/diskimage_builder/elements/pip-and-virtualenv/README.rst @@ -4,6 +4,10 @@ pip-and-virtualenv 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 =============== diff --git a/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip b/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip index c7ee74849..0d4faa836 100755 --- a/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip +++ b/diskimage_builder/elements/pip-and-virtualenv/install.d/pip-and-virtualenv-source-install/04-install-pip @@ -115,7 +115,7 @@ else # time and you had to use "python -m venv". Since then virtualenv # has gained 3.4 support so the pip install below will work 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 apt-get -y install $packages @@ -126,12 +126,9 @@ else # These install into /usr/local/bin so override any packages, even # if installed later. - if [[ ${DIB_PYTHON_VERSION} == 3 ]]; then - python3 /tmp/get-pip.py $pip_args - pip3 install $pip_args virtualenv - else - python2 /tmp/get-pip.py $pip_args - pip install $pip_args virtualenv - fi + python3 /tmp/get-pip.py $pip_args + python2 /tmp/get-pip.py $pip_args + pip3 install $pip_args virtualenv + pip install $pip_args virtualenv fi