#!/bin/bash -eu

mkdir -p src/common/proto
rm -rf src/common/proto/*.py
touch src/common/proto/__init__.py
python3 -m grpc_tools.protoc -I=./proto --python_out=src/common/proto/ --grpc_python_out=src/common/proto/ proto/*.proto
find src/common/proto -type f -iname *.py -exec sed -i -E 's/(import\ .*)_pb2/from . \1_pb2/g' {} \;
