diff --git a/diskimage_builder/elements/pip-and-virtualenv/README.rst b/diskimage_builder/elements/pip-and-virtualenv/README.rst index bf79ff2f..e056a216 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 c7ee7484..0d4faa83 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