#!/bin/bash -eu

py -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto monitoring.proto
py -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto context.proto
py -m grpc_tools.protoc -I../../proto --python_out=proto --grpc_python_out=proto kpi_sample_types.proto

rm proto/context_pb2_grpc.py
rm proto/kpi_sample_types_pb2_grpc.py

sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/monitoring_pb2.py
sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/monitoring_pb2_grpc.py
sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' proto/context_pb2.py

