From dd2e243997098d086f2cbc84b31e093608a96834 Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Fri, 25 Oct 2024 12:32:48 +0200 Subject: [PATCH] chore(python): update backend sample to consume grpcio from venv (#3961) Backends can as well depends on grpcio and require different versions from the ones that are installed in the system. Signed-off-by: Ettore Di Giacinto --- backend/python/common/template/Makefile | 5 +++-- backend/python/common/template/protogen.sh | 6 ++++++ backend/python/common/template/requirements.txt | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 backend/python/common/template/protogen.sh diff --git a/backend/python/common/template/Makefile b/backend/python/common/template/Makefile index 6cc45707..c0e5169f 100644 --- a/backend/python/common/template/Makefile +++ b/backend/python/common/template/Makefile @@ -1,8 +1,9 @@ .DEFAULT_GOAL := install .PHONY: install -install: protogen +install: bash install.sh + $(MAKE) protogen .PHONY: protogen protogen: backend_pb2_grpc.py backend_pb2.py @@ -12,7 +13,7 @@ protogen-clean: $(RM) backend_pb2_grpc.py backend_pb2.py backend_pb2_grpc.py backend_pb2.py: - python3 -m grpc_tools.protoc -I../.. --python_out=. --grpc_python_out=. backend.proto + bash protogen.sh .PHONY: clean clean: protogen-clean diff --git a/backend/python/common/template/protogen.sh b/backend/python/common/template/protogen.sh new file mode 100644 index 00000000..32f39fbb --- /dev/null +++ b/backend/python/common/template/protogen.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e + +source $(dirname $0)/../common/libbackend.sh + +python3 -m grpc_tools.protoc -I../.. --python_out=. --grpc_python_out=. backend.proto \ No newline at end of file diff --git a/backend/python/common/template/requirements.txt b/backend/python/common/template/requirements.txt index 16716764..b59960b2 100644 --- a/backend/python/common/template/requirements.txt +++ b/backend/python/common/template/requirements.txt @@ -1,2 +1,3 @@ grpcio==1.67.0 -protobuf \ No newline at end of file +protobuf +grpcio-tools \ No newline at end of file