Skip to content
Snippets Groups Projects
Commit 0bd13ed8 authored by Masood Malekghassemi's avatar Masood Malekghassemi
Browse files

Fall back to default python for test virtualenvs

parent 6db60b90
No related branches found
No related tags found
No related merge requests found
...@@ -33,6 +33,7 @@ set -ex ...@@ -33,6 +33,7 @@ set -ex
# change to grpc repo root # change to grpc repo root
cd $(dirname $0)/../.. cd $(dirname $0)/../..
# Arguments
PYTHON=${1:-python2.7} PYTHON=${1:-python2.7}
VENV=${2:-py27} VENV=${2:-py27}
VENV_RELATIVE_PYTHON=${3:-bin/python} VENV_RELATIVE_PYTHON=${3:-bin/python}
...@@ -42,6 +43,10 @@ ROOT=`pwd` ...@@ -42,6 +43,10 @@ ROOT=`pwd`
export CFLAGS="-I$ROOT/include -std=gnu99 -fno-wrapv" export CFLAGS="-I$ROOT/include -std=gnu99 -fno-wrapv"
export GRPC_PYTHON_BUILD_WITH_CYTHON=1 export GRPC_PYTHON_BUILD_WITH_CYTHON=1
# Default python on the host to fall back to when instantiating e.g. the
# virtualenv.
HOST_PYTHON=${HOST_PYTHON:-python}
# If ccache is available, use it... unless we're on Mac, then all hell breaks # If ccache is available, use it... unless we're on Mac, then all hell breaks
# loose because Python does hacky things to support other hacky things done to # loose because Python does hacky things to support other hacky things done to
# hacky things on Mac OS X # hacky things on Mac OS X
...@@ -71,7 +76,14 @@ if [ "$CONFIG" = "gcov" ]; then ...@@ -71,7 +76,14 @@ if [ "$CONFIG" = "gcov" ]; then
export GRPC_PYTHON_ENABLE_CYTHON_TRACING=1 export GRPC_PYTHON_ENABLE_CYTHON_TRACING=1
fi fi
($PYTHON -m virtualenv $VENV || true) # Instnatiate the virtualenv, preferring to do so from the relevant python
# version. Even if these commands fail (e.g. on Windows due to name conflicts)
# it's possible that the virtualenv is still usable and we trust the tester to
# be able to 'figure it out' instead of us e.g. doing potentially expensive and
# unnecessary error recovery by `rm -rf`ing the virtualenv.
($PYTHON -m virtualenv $VENV ||
$HOST_PYTHON -m virtualenv -p $PYTHON $VENV ||
true)
VENV_PYTHON=`$REALPATH -s "$VENV/$VENV_RELATIVE_PYTHON"` VENV_PYTHON=`$REALPATH -s "$VENV/$VENV_RELATIVE_PYTHON"`
# pip-installs the directory specified. Used because on MSYS the vanilla Windows # pip-installs the directory specified. Used because on MSYS the vanilla Windows
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment