aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar Masood Malekghassemi <soltanmm@users.noreply.github.com>2015-10-05 15:25:39 -0700
committerGravatar Masood Malekghassemi <soltanmm@users.noreply.github.com>2015-10-05 18:02:51 -0700
commit9554534b5e649c30e6e6ef219eed25f954a9a03f (patch)
tree2898adf6b4421bbcf08f2b01e9e1173b380fc2b6 /tools
parente1d8d4dc1bdf54273b7ed9d4a495789430cbdf6c (diff)
Clean up build_python.sh
This is in preparation for the eventual refactoring of the run_tests.py system.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/run_tests/build_python.sh62
1 files changed, 49 insertions, 13 deletions
diff --git a/tools/run_tests/build_python.sh b/tools/run_tests/build_python.sh
index 2efc2c714d..eb38614675 100755
--- a/tools/run_tests/build_python.sh
+++ b/tools/run_tests/build_python.sh
@@ -39,6 +39,46 @@ GRPCIO=$ROOT/src/python/grpcio
GRPCIO_TEST=$ROOT/src/python/grpcio_test
GRPCIO_HEALTH_CHECKING=$ROOT/src/python/grpcio_health_checking
+#
+# Dependency steps.
+#
+install_grpcio_deps() {
+ cd $GRPCIO
+ pip install -r requirements.txt
+}
+install_grpcio_test_deps() {
+ cd $GRPCIO_TEST
+ pip install -r requirements.txt
+}
+#
+# End dependency steps.
+#
+
+#
+# Install steps. Requires that the `pip` command is appropriate (i.e. that the
+# virtual environment has been activated).
+#
+install_grpcio() {
+ CFLAGS="-I$ROOT/include -std=c89" LDFLAGS=-L$ROOT/libs/$CONFIG GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install $GRPCIO
+}
+install_grpcio_test() {
+ pip install $GRPCIO_TEST
+}
+install_grpcio_health_checking() {
+ pip install $GRPCIO_HEALTH_CHECKING
+}
+#
+# End install steps.
+#
+
+# Cleans the environment of previous installations
+clean_grpcio_all() {
+ (yes | pip uninstall grpcio) || true
+ (yes | pip uninstall grpcio_test) || true
+ (yes | pip uninstall grpcio_health_checking) || true
+}
+
+# Builds the testing environment.
make_virtualenv() {
virtualenv_name="python"$1"_virtual_environment"
if [ ! -d $virtualenv_name ]
@@ -48,33 +88,29 @@ make_virtualenv() {
source $virtualenv_name/bin/activate
# Install grpcio
- cd $GRPCIO
- pip install -r requirements.txt
- CFLAGS="-I$ROOT/include -std=c89" LDFLAGS=-L$ROOT/libs/$CONFIG GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install $GRPCIO
+ install_grpcio_deps
+ install_grpcio
# Install grpcio_test
- cd $GRPCIO_TEST
- pip install -r requirements.txt
- pip install $GRPCIO_TEST
+ install_grpcio_test_deps
+ install_grpcio_test
# Install grpcio_health_checking
- pip install $GRPCIO_HEALTH_CHECKING
+ install_grpcio_health_checking
else
source $virtualenv_name/bin/activate
# Uninstall and re-install the packages we care about. Don't use
# --force-reinstall or --ignore-installed to avoid propagating this
# unnecessarily to dependencies. Don't use --no-deps to avoid missing
# dependency upgrades.
- (yes | pip uninstall grpcio) || true
- (yes | pip uninstall grpcio_test) || true
- (yes | pip uninstall grpcio_health_checking) || true
- (CFLAGS="-I$ROOT/include -std=c89" LDFLAGS=-L$ROOT/libs/$CONFIG GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install $GRPCIO) || (
+ clean_grpcio_all
+ install_grpcio || (
# Fall back to rebuilding the entire environment
rm -rf $virtualenv_name
make_virtualenv $1
)
- pip install $GRPCIO_TEST
- pip install $GRPCIO_HEALTH_CHECKING
+ install_grpcio_test
+ install_grpcio_health_checking
fi
}