| 1 |
#!/bin/bash |
| 2 |
# Copyright 2020 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 |
|
| 16 |
trap 'date' DEBUG |
| 17 |
set -ex |
| 18 |
|
| 19 |
# change to grpc repo root |
| 20 |
cd "$(dirname "$0")/../../.." |
| 21 |
|
| 22 |
sudo apt-get install -y python3-pip |
| 23 |
sudo python3 -m pip install --upgrade pip |
| 24 |
sudo python3 -m pip install --upgrade setuptools |
| 25 |
sudo python3 -m pip install --upgrade grpcio==1.31.0 grpcio-tools==1.31.0 protobuf google-api-python-client google-auth-httplib2 oauth2client xds-protos |
| 26 |
|
| 27 |
# Prepare generated Python code. |
| 28 |
TOOLS_DIR=tools/run_tests |
| 29 |
PROTO_SOURCE_DIR=src/proto/grpc/testing |
| 30 |
PROTO_DEST_DIR=${TOOLS_DIR}/${PROTO_SOURCE_DIR} |
| 31 |
mkdir -p ${PROTO_DEST_DIR} |
| 32 |
|
| 33 |
python3 -m grpc_tools.protoc \ |
| 34 |
--proto_path=. \ |
| 35 |
--python_out=${TOOLS_DIR} \ |
| 36 |
--grpc_python_out=${TOOLS_DIR} \ |
| 37 |
${PROTO_SOURCE_DIR}/test.proto \ |
| 38 |
${PROTO_SOURCE_DIR}/messages.proto \ |
| 39 |
${PROTO_SOURCE_DIR}/empty.proto |
| 40 |
|
| 41 |
HEALTH_PROTO_SOURCE_DIR=src/proto/grpc/health/v1 |
| 42 |
HEALTH_PROTO_DEST_DIR=${TOOLS_DIR}/${HEALTH_PROTO_SOURCE_DIR} |
| 43 |
mkdir -p ${HEALTH_PROTO_DEST_DIR} |
| 44 |
|
| 45 |
python3 -m grpc_tools.protoc \ |
| 46 |
--proto_path=. \ |
| 47 |
--python_out=${TOOLS_DIR} \ |
| 48 |
--grpc_python_out=${TOOLS_DIR} \ |
| 49 |
${HEALTH_PROTO_SOURCE_DIR}/health.proto |