• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
16set -ex
17
18# change to grpc repo root
19cd "$(dirname "$0")/../../.."
20
21sudo apt-get install -y python3-pip
22sudo python3 -m pip install --upgrade pip
23sudo python3 -m pip install grpcio grpcio-tools google-api-python-client google-auth-httplib2 oauth2client
24
25# Prepare generated Python code.
26TOOLS_DIR=tools/run_tests
27PROTO_SOURCE_DIR=src/proto/grpc/testing
28PROTO_DEST_DIR=${TOOLS_DIR}/${PROTO_SOURCE_DIR}
29mkdir -p ${PROTO_DEST_DIR}
30
31python3 -m grpc_tools.protoc \
32    --proto_path=. \
33    --python_out=${TOOLS_DIR} \
34    --grpc_python_out=${TOOLS_DIR} \
35    ${PROTO_SOURCE_DIR}/test.proto \
36    ${PROTO_SOURCE_DIR}/messages.proto \
37    ${PROTO_SOURCE_DIR}/empty.proto
38