Skip to content

Commit

Permalink
chore: Add support for Python 3.12 in create_virtualenv script
Browse files Browse the repository at this point in the history
  • Loading branch information
nadeemshahzad committed Nov 26, 2024
1 parent 704d1e5 commit 46b524a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion util/jenkins/virtualenv_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,20 @@ function create_virtualenv () {
fi

# create a unique hash for the job based location of where job is run
echo "Creating venv for $(pwd)"
venvname="$(pwd | md5sum | cut -d' ' -f1)"

# Determine which virtualenv executable to use
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.
Expand Down

0 comments on commit 46b524a

Please sign in to comment.