[Bazel] Use pyenv to select Python 3.9.5 on our linux/bazel builds. (#10009)
We still need to use python2 when running autotools.pull/10010/head
parent
30f6c7851b
commit
bb27447f42
3 changed files with 30 additions and 30 deletions
@ -0,0 +1,16 @@ |
||||
# Shared logic to choose a Python version with pyenv. |
||||
# |
||||
# This file should be `source`d. |
||||
|
||||
# Requested version of Python can be overridden by env variable. |
||||
: ${PYTHON_VERSION:=3.9.5} |
||||
|
||||
if pyenv --version >/dev/null ; then |
||||
eval "$(pyenv init -)" |
||||
if ! pyenv global ${PYTHON_VERSION}; then |
||||
echo "Python ${PYTHON_VERSION} is not available. Versions available:" >&2 |
||||
pyenv versions >&2 |
||||
exit 1 |
||||
fi |
||||
fi |
||||
echo "Using $(python --version || python3 --version)" |
Loading…
Reference in new issue