From 9530f1844a1cf4fb0effe370ff65b520ed538a15 Mon Sep 17 00:00:00 2001
From: Stephen Finucane <stephenfin@redhat.com>
Date: Tue, 3 Dec 2024 17:04:39 +0000
Subject: [PATCH] Install setuptools 'core' extra

Under as-yet-unidentified conditions, we can end up with a version of
packaging that is too old for the version of latest version of
setuptools. This is a known issue and expected behavior and per [1]
$subject is the preferred resolution.

[1] https://github.com/pypa/setuptools/issues/4483#issuecomment-2237219597

Change-Id: I9232f3fae1598297e83c4ea37339896f7dcbd44f
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
(cherry picked from commit 320c2bf42ae41d751c72d80a6c85b26f3f6951bd)
---
 inc/python | 4 ++--
 lib/infra  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/inc/python b/inc/python
index 2083b74dc1..19b0563902 100644
--- a/inc/python
+++ b/inc/python
@@ -40,8 +40,8 @@ function setup_devstack_virtualenv {
         # Using system site packages to enable nova to use libguestfs.
         # This package is currently installed via the distro and not
         # available on pypi.
-        python$PYTHON3_VERSION -m venv --system-site-packages $DEVSTACK_VENV
-        pip_install -U pip setuptools
+        $PYTHON -m venv --system-site-packages "${DEVSTACK_VENV}"
+        pip_install -U pip setuptools[core]
         #NOTE(rpittau): workaround for simplejson removal in osc
         #  https://review.opendev.org/c/openstack/python-openstackclient/+/920001
         pip_install -U simplejson
diff --git a/lib/infra b/lib/infra
index 2aad00354a..f4760c352c 100644
--- a/lib/infra
+++ b/lib/infra
@@ -31,7 +31,7 @@ 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
+    PIP_VIRTUAL_ENV=$PIP_VIRTUAL_ENV pip_install -U pbr setuptools[core]
     PIP_VIRTUAL_ENV=$PIP_VIRTUAL_ENV pip_install $REQUIREMENTS_DIR
 
     # Unset the PIP_VIRTUAL_ENV so that PBR does not end up trapped