• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright 2024 The gRPC Authors
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15
16set -ex
17
18BASEDIR=$(dirname "$0")/../..
19PACKAGES="grpcio_channelz  grpcio_csds  grpcio_admin grpcio_health_checking  grpcio_reflection  grpcio_status  grpcio_testing grpcio_csm_observability grpcio_tests"
20
21# Change to grpc repo root
22cd "$BASEDIR";
23
24# unit-tests setup starts from here
25function maybe_run_command () {
26  if python3 setup.py --help-commands | grep "$1" &>/dev/null; then
27    python3 setup.py "$1";
28  fi
29}
30
31python3 -m pip install --upgrade "cython<4.0.0rc1";
32python3 setup.py install;
33
34# Build and install grpcio_tools
35pushd tools/distrib/python/grpcio_tools;
36  ../make_grpcio_tools.py
37  GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install .
38popd;
39
40# Build and install grpcio_observability
41pushd src/python/grpcio_observability;
42  ./make_grpcio_observability.py
43  GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install .
44popd;
45
46# Install xds_protos
47pushd tools/distrib/python/xds_protos;
48  GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install .
49popd;
50
51# Build and install individual gRPC packages
52pushd src/python;
53  for PACKAGE in ${PACKAGES}; do
54    pushd "${PACKAGE}";
55      python3 setup.py clean;
56      maybe_run_command preprocess
57      maybe_run_command build_package_protos
58      python3 -m pip install .;
59    popd;
60  done
61popd;
62