Change sed command's -i opt-value for MacOS

This commit is contained in:
ghubstan 2022-03-24 07:55:46 -03:00
parent 2e229fbdf6
commit 3171316ea7
No known key found for this signature in database
GPG Key ID: E35592D6800A861E

View File

@ -17,5 +17,13 @@ protoc --proto_path=$PROTO_PATH --python_out=$PYTHON_PROTO_OUT_PATH $PROTO_PATH/
# Hack the internal import statements in the generated python to prepend the `bisq.api` package name.
# See why Google will not fix this: https://github.com/protocolbuffers/protobuf/issues/1491
sed -i 's/import pb_pb2 as pb__pb2/import bisq.api.pb_pb2 as pb__pb2/g' $PYTHON_PROTO_OUT_PATH/grpc_pb2.py
sed -i 's/import grpc_pb2 as grpc__pb2/import bisq.api.grpc_pb2 as grpc__pb2/g' $PYTHON_PROTO_OUT_PATH/grpc_pb2_grpc.py
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
sed -i 's/import pb_pb2 as pb__pb2/import bisq.api.pb_pb2 as pb__pb2/g' $PYTHON_PROTO_OUT_PATH/grpc_pb2.py
sed -i 's/import grpc_pb2 as grpc__pb2/import bisq.api.grpc_pb2 as grpc__pb2/g' $PYTHON_PROTO_OUT_PATH/grpc_pb2_grpc.py
elif [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' 's/import pb_pb2 as pb__pb2/import bisq.api.pb_pb2 as pb__pb2/g' $PYTHON_PROTO_OUT_PATH/grpc_pb2.py
sed -i '' 's/import grpc_pb2 as grpc__pb2/import bisq.api.grpc_pb2 as grpc__pb2/g' $PYTHON_PROTO_OUT_PATH/grpc_pb2_grpc.py
else
echo "Unsupported OS $OSTYPE"
exit 1
fi