From 4793ceba5faeac659d9db9b5fc4edde325155710 Mon Sep 17 00:00:00 2001 From: Aurelien Lourot Date: Wed, 13 Oct 2021 10:15:47 +0200 Subject: [PATCH] Wrap pip to force pip<20.3 and setuptools<50.0.0 Osci runs the CI jobs on Bionic, this version of tox (2.5) will automatically upgrade the packages at virtualenv creation and any pinning won't have effect since the virtualenv created is upgraded to the latest versions of pip and setuptools. This behavior was changed in tox 3.10 with the addition of the 'download' directive[0] Setuptools 58.0 dropped the support for use_2to3=true which is needed to install blessings (an indirect dependency of charm-tools) since then the gate got broken. This is similar to: https://github.com/openstack-charmers/release-tools/pull/156 https://github.com/openstack-charmers/release-tools/pull/157 Change-Id: I7f22cd744a7aa5747cca49f094a5efd041481a80 Co-authored-by: Felipe Reyes --- pip.sh | 18 ++++++++++++++++++ tox.ini | 18 +++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 pip.sh diff --git a/pip.sh b/pip.sh new file mode 100755 index 0000000..9a7e6b0 --- /dev/null +++ b/pip.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# +# This file is managed centrally by release-tools and should not be modified +# within individual charm repos. See the 'global' dir contents for available +# choices of tox.ini for OpenStack Charms: +# https://github.com/openstack-charmers/release-tools +# +# setuptools 58.0 dropped the support for use_2to3=true which is needed to +# install blessings (an indirect dependency of charm-tools). +# +# More details on the beahvior of tox and virtualenv creation can be found at +# https://github.com/tox-dev/tox/issues/448 +# +# This script is wrapper to force the use of the pinned versions early in the +# process when the virtualenv was created and upgraded before installing the +# depedencies declared in the target. +pip install 'pip<20.3' 'setuptools<50.0.0' +pip "$@" diff --git a/tox.ini b/tox.ini index 87170ca..575fab0 100644 --- a/tox.ini +++ b/tox.ini @@ -7,6 +7,22 @@ sitepackages = False # NOTE(beisner): Avoid false positives by not skipping missing interpreters. skip_missing_interpreters = False +# NOTES: +# * We avoid the new dependency resolver by pinning pip < 20.3, see +# https://github.com/pypa/pip/issues/9187 +# * Pinning dependencies requires tox >= 3.2.0, see +# https://tox.readthedocs.io/en/latest/config.html#conf-requires +# * It is also necessary to pin virtualenv as a newer virtualenv would still +# lead to fetching the latest pip in the func* tox targets, see +# https://stackoverflow.com/a/38133283 +requires = + pip < 20.3 + virtualenv < 20.0 + setuptools<50.0.0 + +# NOTE: https://wiki.canonical.com/engineering/OpenStack/InstallLatestToxOnOsci +minversion = 3.18.0 + [testenv] basepython = python3 setenv = VIRTUAL_ENV={envdir} @@ -15,7 +31,7 @@ setenv = VIRTUAL_ENV={envdir} JUJU_REPOSITORY={envdir}/tmp/build passenv = http_proxy https_proxy install_command = - pip install {opts} {packages} + {toxinidir}/pip.sh install {opts} {packages} deps = -r{toxinidir}/requirements.txt whitelist_externals = /bin/true /bin/echo /bin/mkdir /bin/ln