From bf95b814ed3c2e9c37a6b1c808fe4ab1f3d7a0d4 Mon Sep 17 00:00:00 2001 From: nadeemshahzad Date: Tue, 26 Nov 2024 19:52:09 +0500 Subject: [PATCH] chore: Add support for Python 3.12 in create_virtualenv script --- util/jenkins/virtualenv_tools.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/util/jenkins/virtualenv_tools.sh b/util/jenkins/virtualenv_tools.sh index 01f51d3ae5c..b00e306c732 100644 --- a/util/jenkins/virtualenv_tools.sh +++ b/util/jenkins/virtualenv_tools.sh @@ -38,8 +38,16 @@ function create_virtualenv () { # create a unique hash for the job based location of where job is run venvname="$(pwd | md5sum | cut -d' ' -f1)" + if [[ "$@" == *"--python=python3.12"* ]]; then + # Use python3.12 with -m virtualenv if Python 3.12 is specified + venv_exec="/opt/python3.12/bin/python3.12 -m virtualenv" + else + # Use the system default virtualenv for other Python versions + venv_exec="virtualenv" + fi + # create the virtualenv - virtualenv "$@" "$JOBVENVDIR/$venvname" + "$venv_exec" "$@" "$JOBVENVDIR/$venvname" # This variable is created in global scope if function is sourced # so we can access it after running this function.