Skip to content

Commit 82e42d4

Browse files
build: recreate broken local venv before runner setup (#6465)
1 parent a5017a0 commit 82e42d4

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

utils/build/build.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,14 @@ build() {
145145
echo Build $IMAGE_NAME
146146
if [[ $IMAGE_NAME == runner ]] && [[ $DOCKER_MODE != 1 ]]; then
147147
if [[ -z "${IN_NIX_SHELL:-}" ]]; then
148+
# Homebrew/Python upgrades can invalidate an existing venv.
149+
# If the interpreter is broken, recreate the venv automatically.
150+
if [ -d "venv/" ] && ! venv/bin/python -V >/dev/null 2>&1
151+
then
152+
echo "Existing venv is broken. Recreating it."
153+
rm -rf venv
154+
fi
155+
148156
if [ ! -d "venv/" ]
149157
then
150158
echo "Build virtual env"

0 commit comments

Comments
 (0)