From 7b3a94680451f4bf5eb902ae63658d33d8029bdd Mon Sep 17 00:00:00 2001 From: Aric Gardner Date: Wed, 4 Mar 2020 15:46:18 -0500 Subject: [PATCH] Python 3.5 and python2 tox in Ubuntu 16.04 Ubuntu 16.04 calls a python2 version of tox. so we must upgrade it even if we are testing with python3 ubuntu 16.04 has python 3.5 we must pinn the zipp package Signed-off-by: Aric Gardner Change-Id: I4d2513c15baf4f00313885b35f8f0a297874b2b3 --- .../fix-python-35-ubuntu1604-d9d6cec207b568d7.yaml | 9 +++++++++ shell/python-tools-install.sh | 9 +++++++++ shell/tox-install.sh | 23 +++++++++++++++++----- 3 files changed, 36 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/fix-python-35-ubuntu1604-d9d6cec207b568d7.yaml diff --git a/releasenotes/notes/fix-python-35-ubuntu1604-d9d6cec207b568d7.yaml b/releasenotes/notes/fix-python-35-ubuntu1604-d9d6cec207b568d7.yaml new file mode 100644 index 00000000..e57d2e7e --- /dev/null +++ b/releasenotes/notes/fix-python-35-ubuntu1604-d9d6cec207b568d7.yaml @@ -0,0 +1,9 @@ +--- +fixes: + - | + Workarounds for aging python 3.5 on Ubuntu 16.04 builders + Ubuntu 16.04 calls a python2 version of tox we must upgrade + it even if we are testing with python3 + ubuntu 16.04 runs python 3.5 we must pin the zipp package + more pins will be needed as packages drop support for python 3.5 + ideally projects will move away from this distro. diff --git a/shell/python-tools-install.sh b/shell/python-tools-install.sh index 3a852d34..eae3c1f4 100644 --- a/shell/python-tools-install.sh +++ b/shell/python-tools-install.sh @@ -33,6 +33,15 @@ tox>=3.7.0 # Tox 3.7 or greater is necessary for parallel mode support yq EOF + #Python 3.5 in Ubuntu 16.04 workaround + if [[ -f /etc/lsb-release ]]; then + # shellcheck disable=SC1091 + source /etc/lsb-release + if [[ $DISTRIB_RELEASE == "16.04" ]]; then + echo "WARNING: Python projects should move to Ubuntu 18.04 to continue receiving support" + echo "zipp==1.1.0" >> "$requirements_file" + fi + fi # Use `python -m pip` to upgrade to the latest pip into user site-packages python3 -m pip install --user --quiet --upgrade pip python3 -m pip install --user --quiet --no-warn-script-location --upgrade setuptools diff --git a/shell/tox-install.sh b/shell/tox-install.sh index cc815ccd..9ad33295 100644 --- a/shell/tox-install.sh +++ b/shell/tox-install.sh @@ -14,12 +14,25 @@ echo "---> tox-install.sh" # Use -x to show value of $PYTHON in output set -eux -o pipefail -# Tox version is pulled in through detox to mitigate version conflict +#Python 3.5 and python2 tox in Ubuntu 16.04 workaround +done="False" +if [[ -f /etc/lsb-release ]]; then + # shellcheck disable=SC1091 + source /etc/lsb-release + if [[ $DISTRIB_RELEASE == "16.04" ]]; then + echo "WARNING: Python projects should move to Ubuntu 18.04 to continue receiving support" + python2 -m pip install --user --quiet --upgrade tox tox-pyenv virtualenv more-itertools~=5.0.0 + python3 -m pip install --user --quiet --upgrade tox tox-pyenv virtualenv zipp==1.1.0 + done="True" + fi +fi -if [[ $PYTHON == "python2" ]]; then - $PYTHON -m pip install --user --quiet --upgrade tox tox-pyenv virtualenv more-itertools~=5.0.0 -else - $PYTHON -m pip install --user --quiet --upgrade tox tox-pyenv virtualenv +if [[ $done != "True" ]]; then + if [[ $PYTHON == "python2" ]]; then + $PYTHON -m pip install --user --quiet --upgrade tox tox-pyenv virtualenv more-itertools~=5.0.0 + else + $PYTHON -m pip install --user --quiet --upgrade tox tox-pyenv virtualenv + fi fi # installs are silent, show version details in log -- 2.16.6