From 1dee5d0cde64e2d8c8525723e3dfc4cc3488482f Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Mon, 9 Feb 2026 11:41:14 +0000 Subject: [PATCH] [Stable-Only] Pin setuptools setuptools 82.0.0 dropped support for the legacy 'pkg_resources' library. While most users of this (including the all important pbr library) have been updated to remove references to 'pkg_resources' on current master, this is not true for historical releases. Pin the setuptools version used on these historic branches and disable build isolation to work around this. Change-Id: Icf07fa246b3532f939d20e3cbea32cc0b7b439ed Signed-off-by: Stephen Finucane --- inc/python | 7 ++++++- lib/infra | 4 +++- tox.ini | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/inc/python b/inc/python index cd90ac82c6..73928ac48b 100644 --- a/inc/python +++ b/inc/python @@ -41,7 +41,9 @@ function setup_devstack_virtualenv { # This package is currently installed via the distro and not # available on pypi. $PYTHON -m venv --system-site-packages "${DEVSTACK_VENV}" - pip_install -U pip setuptools[core] + # NOTE(stephenfin) stable-only change to pin setuptools to the last + # version to support pkg_resources + pip_install -U pip 'setuptools[core]<82.0.0' fi if [[ ":$PATH:" != *":$DEVSTACK_VENV/bin:"* ]] ; then export PATH="$DEVSTACK_VENV/bin:$PATH" @@ -203,6 +205,9 @@ function pip_install { cmd_pip="$cmd_pip install" # Always apply constraints cmd_pip="$cmd_pip -c $REQUIREMENTS_DIR/upper-constraints.txt" + # NOTE(stephenfin): stable-only change to disable build-isolation so that + # we can pin setuptools on these old branches + cmd_pip="$cmd_pip --no-build-isolation" $xtrace diff --git a/lib/infra b/lib/infra index f4760c352c..1318548d9f 100644 --- a/lib/infra +++ b/lib/infra @@ -31,7 +31,9 @@ function install_infra { local PIP_VIRTUAL_ENV="$REQUIREMENTS_DIR/.venv" [ ! -d $PIP_VIRTUAL_ENV ] && ${VIRTUALENV_CMD} $PIP_VIRTUAL_ENV # We don't care about testing git pbr in the requirements venv. - PIP_VIRTUAL_ENV=$PIP_VIRTUAL_ENV pip_install -U pbr setuptools[core] + # NOTE(stephenfin) stable-only change to pin setuptools to the last version + # to support pkg_resources + PIP_VIRTUAL_ENV=$PIP_VIRTUAL_ENV pip_install -U pbr 'setuptools[core]<82.0.0' PIP_VIRTUAL_ENV=$PIP_VIRTUAL_ENV pip_install $REQUIREMENTS_DIR # Unset the PIP_VIRTUAL_ENV so that PBR does not end up trapped diff --git a/tox.ini b/tox.ini index 02224c620e..8017329d02 100644 --- a/tox.ini +++ b/tox.ini @@ -37,6 +37,8 @@ commands = bash -c "find {toxinidir} \ deps = -c{env:TOX_CONSTRAINTS_FILE:https://releases.openstack.org/constraints/upper/2025.2} -r{toxinidir}/doc/requirements.txt + # NOTE(stephenfin): pin setuptools to the last version to support pkg_resources + setuptools<82.0.0 allowlist_externals = bash setenv = TOP_DIR={toxinidir}