aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/distrib/python
diff options
context:
space:
mode:
authorGravatar Masood Malekghassemi <atash@google.com>2016-07-13 16:53:09 -0700
committerGravatar Masood Malekghassemi <atash@google.com>2016-07-15 23:48:25 -0700
commit302bfd1a108c048a1db81236acc0c41fb84ae3b5 (patch)
tree6db215c4671da7dc0279ae5bd6b0c8c51b55b1aa /test/distrib/python
parent24ae8eaa8d60e7b3b13381179c217796e01b6697 (diff)
Test Python source distribution installation
Diffstat (limited to 'test/distrib/python')
-rwxr-xr-xtest/distrib/python/run_distrib_test.sh55
1 files changed, 34 insertions, 21 deletions
diff --git a/test/distrib/python/run_distrib_test.sh b/test/distrib/python/run_distrib_test.sh
index 8a983bc248..0c2154838f 100755
--- a/test/distrib/python/run_distrib_test.sh
+++ b/test/distrib/python/run_distrib_test.sh
@@ -33,34 +33,47 @@ set -ex
cd $(dirname $0)
# Pick up the source dist archive whatever its version is
+SDIST_ARCHIVES=$EXTERNAL_GIT_ROOT/input_artifacts/grpcio-*.tar.gz
BDIST_ARCHIVES=$EXTERNAL_GIT_ROOT/input_artifacts/grpcio-*.whl
+TOOLS_SDIST_ARCHIVES=$EXTERNAL_GIT_ROOT/input_artifacts/grpcio_tools-*.tar.gz
TOOLS_BDIST_ARCHIVES=$EXTERNAL_GIT_ROOT/input_artifacts/grpcio_tools-*.whl
-if [ ! -f ${SDIST_ARCHIVE} ]
-then
- echo "Archive ${SDIST_ARCHIVE} does not exist."
- exit 1
-fi
+function make_virtualenv() {
+ virtualenv $1
+ $1/bin/python -m pip install --upgrade six pip
+ $1/bin/python -m pip install cython
+}
-PYTHON=python2
-PIP=pip2
-which $PYTHON || PYTHON=python
-which $PIP || PIP=pip
+function at_least_one_installs() {
+ for file in "$@"; do
+ if python -m pip install $file; then
+ return 0
+ fi
+ done
+ return -1
+}
-# TODO(jtattermusch): this shouldn't be required
-# TODO(jtattermusch): run the command twice to workaround docker-on-overlay
-# issue https://github.com/docker/docker/issues/12327
-# (first attempt will fail when using docker with overlayFS)
-${PIP} install --upgrade six pip || ${PIP} install --upgrade six pip
+make_virtualenv bdist_test
+make_virtualenv sdist_test
-# At least one of the bdist packages has to succeed (whichever one matches the
-# test machine, anyway).
-for bdist in ${BDIST_ARCHIVES} ${TOOLS_BDIST_ARCHIVES}; do
- ($PYTHON -m pip install $bdist) || true
-done
+#
+# Install our distributions in order of dependencies
+#
+
+(source bdist_test/bin/activate && at_least_one_installs ${BDIST_ARCHIVES})
+(source bdist_test/bin/activate && at_least_one_installs ${TOOLS_BDIST_ARCHIVES})
+
+(source sdist_test/bin/activate && at_least_one_installs ${SDIST_ARCHIVES})
+(source sdist_test/bin/activate && at_least_one_installs ${TOOLS_SDIST_ARCHIVES})
+
+#
+# Test our distributions
+#
# TODO(jtattermusch): add a .proto file to the distribtest, generate python
# code from it and then use the generated code from distribtest.py
-$PYTHON -m grpc.tools.protoc
+(source bdist_test/bin/activate && python -m grpc.tools.protoc --help)
+(source sdist_test/bin/activate && python -m grpc.tools.protoc --help)
-$PYTHON distribtest.py
+(source bdist_test/bin/activate && python distribtest.py)
+(source sdist_test/bin/activate && python distribtest.py)