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 16trap 'date' DEBUG 17set -ex 18 19# change to grpc repo root 20cd "$(dirname "$0")/../../.." 21 22sudo apt-get install -y python3-pip 23sudo python3 -m pip install --upgrade pip 24sudo python3 -m pip install --upgrade setuptools 25sudo 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. 28TOOLS_DIR=tools/run_tests 29PROTO_SOURCE_DIR=src/proto/grpc/testing 30PROTO_DEST_DIR=${TOOLS_DIR}/${PROTO_SOURCE_DIR} 31mkdir -p ${PROTO_DEST_DIR} 32 33python3 -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 41HEALTH_PROTO_SOURCE_DIR=src/proto/grpc/health/v1 42HEALTH_PROTO_DEST_DIR=${TOOLS_DIR}/${HEALTH_PROTO_SOURCE_DIR} 43mkdir -p ${HEALTH_PROTO_DEST_DIR} 44 45python3 -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 50