prep_xds.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. trap 'date' DEBUG
  16. set -ex
  17. # change to grpc repo root
  18. cd "$(dirname "$0")/../../.."
  19. sudo apt-get install -y python3-pip
  20. sudo python3 -m pip install --upgrade pip
  21. sudo python3 -m pip install --upgrade setuptools
  22. 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
  23. # Prepare generated Python code.
  24. TOOLS_DIR=tools/run_tests
  25. PROTO_SOURCE_DIR=src/proto/grpc/testing
  26. PROTO_DEST_DIR=${TOOLS_DIR}/${PROTO_SOURCE_DIR}
  27. mkdir -p ${PROTO_DEST_DIR}
  28. python3 -m grpc_tools.protoc \
  29. --proto_path=. \
  30. --python_out=${TOOLS_DIR} \
  31. --grpc_python_out=${TOOLS_DIR} \
  32. ${PROTO_SOURCE_DIR}/test.proto \
  33. ${PROTO_SOURCE_DIR}/messages.proto \
  34. ${PROTO_SOURCE_DIR}/empty.proto
  35. HEALTH_PROTO_SOURCE_DIR=src/proto/grpc/health/v1
  36. HEALTH_PROTO_DEST_DIR=${TOOLS_DIR}/${HEALTH_PROTO_SOURCE_DIR}
  37. mkdir -p ${HEALTH_PROTO_DEST_DIR}
  38. python3 -m grpc_tools.protoc \
  39. --proto_path=. \
  40. --python_out=${TOOLS_DIR} \
  41. --grpc_python_out=${TOOLS_DIR} \
  42. ${HEALTH_PROTO_SOURCE_DIR}/health.proto