Skip python3-virtualenv on <= trusty

If DIB_PYTHON_VERSION is < 3 on the !redhat path, that means we're on
an older platform that may not have python3-virtualenv packages.  Skip
install.

Ensure the order of operations happens by forcing the installs

Also add a note about limited platform support (patches welcome :)

Change-Id: I18412767f0ebf946d557a0a126285369e96af159
This commit is contained in:
Ian Wienand 2017-04-12 05:49:47 +10:00
parent 79d4113cbe
commit 7a962e9d1c
2 changed files with 23 additions and 7 deletions

View File

@ -47,6 +47,9 @@ The system will be left in the following state:
(note python3 ``virtualenv`` script is *not* installed, see below) (note python3 ``virtualenv`` script is *not* installed, see below)
Source install is supported on limited platforms. See the code, but
this includes Ubuntu and RedHat platforms.
Using the tools Using the tools
=============== ===============

View File

@ -101,15 +101,28 @@ EOF
echo "exclude=$packages" >> ${conf} echo "exclude=$packages" >> ${conf}
fi fi
else else
# pre-install packages, we will overwrite with latest below # pre-install packages so depedencies are there. We will
apt-get -y install python-pip python3-pip \ # overwrite with latest below.
python-virtualenv python3-virtualenv packages="python-pip python3-pip python-virtualenv"
# unfortunately older ubuntu (trusty) doesn't have a
# python3-virtualenv package -- it seems it wasn't ready at the
# 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+=" python3-virtualenv"
fi
apt-get -y install $packages
# force things to happen so our assumptions hold
pip_args="-U --force-reinstall"
# 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.
python3 /tmp/get-pip.py
python2 /tmp/get-pip.py
pip3 install virtualenv python3 /tmp/get-pip.py $pip_args
pip install virtualenv python2 /tmp/get-pip.py $pip_args
pip3 install $pip_args virtualenv
pip install $pip_args virtualenv
fi fi