Skip to content

Commit e5a7d2c

Browse files
Update kokoro tests script to install latest pyenv and stable python release (GoogleCloudPlatform#1868)
1 parent 949de1e commit e5a7d2c

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

test/ci/kokoro/run_integ_tests_helper.sh

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,26 @@ function preferred_python_release {
4848
# Return string with latest Python version triplet for a given version tuple.
4949
# Example: PYVERSION="2.7"; latest_python_release -> "2.7.15"
5050
pyenv install --list \
51-
| grep -vE "(^Available versions:|-src|dev|rc|alpha|beta|(a|b)[0-9]+)" \
51+
| grep -vE "(^Available versions:|-src|dev|rc|alpha|beta|(a|b)[0-9]+|t$)" \
5252
| grep -E "^\s*$PYVERSION" \
5353
| sed -E 's/^[[:space:]]+//' \
5454
| tail -1
5555
}
5656

5757
function install_pyenv {
58-
# Install pyenv if missing.
59-
if ! [ "$(pyenv --version)" ]; then
60-
# MacOS VM does not have pyenv installed by default.
58+
# Install the latest pyenv version to include the latest python versions.
59+
# For installation instructions refer:
60+
# https://github.com/pyenv/pyenv?tab=readme-ov-file#installation
61+
if [[ $KOKORO_JOB_NAME =~ "macos" ]]; then
62+
brew update
63+
brew install pyenv
64+
export PYENV_ROOT="$(brew --prefix pyenv)"
65+
else
6166
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
6267
export PYENV_ROOT="$HOME/.pyenv"
63-
export PATH="$PYENV_ROOT/bin:$PATH"
64-
eval "$(pyenv init --path)"
6568
fi
69+
export PATH="$PYENV_ROOT/bin:$PATH"
70+
eval "$(pyenv init --path)"
6671
}
6772

6873
function install_python {

0 commit comments

Comments
 (0)