Skip to content

Commit afa87ff

Browse files
committed
regenerate venv when python version changes
1 parent ea265e1 commit afa87ff

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

dev/setup-env.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,19 @@ if [[ "$PYTHON_VERSION" == "" ]]; then
1919
if [[ "$OS" == "ubuntu" && "$MAJOR_VERSION" == "22" ]]; then
2020
PYTHON_VERSION="/usr/bin/python3.10"
2121
elif [[ "$OS" == "rocky" && "$MAJOR_VERSION" == "8" ]]; then
22-
# python3.9+ doesn't have selinux bindings
23-
PYTHON_VERSION="/usr/bin/python3.8" # use `sudo yum install python38` on Rocky Linux 8 to install this
22+
PYTHON_VERSION="/usr/bin/python3.12" # use `sudo yum install python3.12` on Rocky Linux 8 to install this
2423
elif [[ "$OS" == "rocky" && "$MAJOR_VERSION" == "9" ]]; then
25-
PYTHON_VERSION="/usr/bin/python3.9"
24+
PYTHON_VERSION="/usr/bin/python3.12"
2625
else
2726
echo "Unsupported OS version: $OS $MAJOR_VERSION"
2827
exit 1
2928
fi
3029
fi
3130

32-
if [[ ! -d "venv" ]]; then
33-
$PYTHON_VERSION -m venv venv
31+
if [[ ! -x venv/bin/python ]] || \
32+
[[ "$($PYTHON_VERSION -V 2>&1)" != "$(venv/bin/python -V 2>&1)" ]]; then
33+
rm -rf venv
34+
$PYTHON_VERSION -m venv venv
3435
fi
3536

3637
# shellcheck disable=SC1091

0 commit comments

Comments
 (0)