Skip to content

Commit bf95b81

Browse files
author
nadeemshahzad
committed
chore: Add support for Python 3.12 in create_virtualenv script
1 parent 704d1e5 commit bf95b81

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

util/jenkins/virtualenv_tools.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,16 @@ function create_virtualenv () {
3838
# create a unique hash for the job based location of where job is run
3939
venvname="$(pwd | md5sum | cut -d' ' -f1)"
4040

41+
if [[ "$@" == *"--python=python3.12"* ]]; then
42+
# Use python3.12 with -m virtualenv if Python 3.12 is specified
43+
venv_exec="/opt/python3.12/bin/python3.12 -m virtualenv"
44+
else
45+
# Use the system default virtualenv for other Python versions
46+
venv_exec="virtualenv"
47+
fi
48+
4149
# create the virtualenv
42-
virtualenv "$@" "$JOBVENVDIR/$venvname"
50+
"$venv_exec" "$@" "$JOBVENVDIR/$venvname"
4351

4452
# This variable is created in global scope if function is sourced
4553
# so we can access it after running this function.

0 commit comments

Comments
 (0)