From cc82266a57c97910ef26305f92ea51d358eb015c Mon Sep 17 00:00:00 2001 From: Abhishek Bongale Date: Thu, 5 Feb 2026 13:39:40 +0000 Subject: [PATCH] Add venv for plugin list generation Isolate dependencies for generate-devstack-plugins-list.sh by creating a dedicated Python virtual environment with required packages. This ensures the script uses the correct version of dependencies regardless of system Python configuration. Closes-Bug: #2138869 Change-Id: I8a7e49b0b908aec7c95b7fbfb6c9a16375f267a6 Signed-off-by: Abhishek Bongale --- tools/generate-devstack-plugins-list.sh | 13 ++++++++++++- tools/requirements.txt | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tools/requirements.txt diff --git a/tools/generate-devstack-plugins-list.sh b/tools/generate-devstack-plugins-list.sh index 3307943df9..45a926392e 100755 --- a/tools/generate-devstack-plugins-list.sh +++ b/tools/generate-devstack-plugins-list.sh @@ -38,6 +38,17 @@ # current working directory, it will be prepended or appended to # the generated reStructuredText plugins table respectively. +# Setup virtual environment +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +VENV_DIR="${SCRIPT_DIR}/.venv" + +if [[ ! -d "${VENV_DIR}" ]]; then + python3 -m venv "${VENV_DIR}" +fi + +source "${VENV_DIR}/bin/activate" +pip install -q -r "${SCRIPT_DIR}/requirements.txt" + # Print the title underline for a RST table. Argument is the length # of the first column, second column is assumed to be "URL" function title_underline { @@ -54,7 +65,7 @@ if [[ -r data/devstack-plugins-registry.header ]]; then cat data/devstack-plugins-registry.header fi -sorted_plugins=$(python3 tools/generate-devstack-plugins-list.py) +sorted_plugins=$("${VENV_DIR}/bin/python3" tools/generate-devstack-plugins-list.py) # find the length of the name column & pad name_col_len=$(echo "${sorted_plugins}" | wc -L) diff --git a/tools/requirements.txt b/tools/requirements.txt new file mode 100644 index 0000000000..f2293605cf --- /dev/null +++ b/tools/requirements.txt @@ -0,0 +1 @@ +requests