From: Aric Gardner Date: Wed, 4 Mar 2020 20:46:18 +0000 (-0500) Subject: Python 3.5 and python2 tox in Ubuntu 16.04 X-Git-Tag: v0.52.0~2^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F90%2F63290%2F8;p=releng%2Fglobal-jjb.git 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 --- 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