diff --git a/packages/google-crc32c/scripts/osx/build_python_wheel.sh b/packages/google-crc32c/scripts/osx/build_python_wheel.sh index 0b9b2da65181..f6ec885b3b13 100755 --- a/packages/google-crc32c/scripts/osx/build_python_wheel.sh +++ b/packages/google-crc32c/scripts/osx/build_python_wheel.sh @@ -39,8 +39,8 @@ eval "$(pyenv init --path)" install_python_pyenv() { version=$1 - - if [ -z "$(pyenv versions --bare | grep $version)" ]; then + escaped_version="${version//./\.}" + if ! pyenv versions --bare | grep -q "^${escaped_version}\b"; then echo "Python $version is not installed. Installing..." pyenv install $version echo "Python $version installed." diff --git a/packages/google-crc32c/scripts/osx/publish_python_wheel.sh b/packages/google-crc32c/scripts/osx/publish_python_wheel.sh index e5d6ab115b6f..7c156758facd 100755 --- a/packages/google-crc32c/scripts/osx/publish_python_wheel.sh +++ b/packages/google-crc32c/scripts/osx/publish_python_wheel.sh @@ -15,7 +15,7 @@ set -eo pipefail -if [ -z "$(pyenv versions --bare | grep 3.10)" ]; then +if ! pyenv versions --bare | grep -q "^3\.10\b"; then echo "Python 3.10 is not installed. Installing..." pyenv install 3.10 fi