Skip to content

Commit ba7da33

Browse files
committed
Makefile: suppress msggen and grpc gen if SUPPRESS_GENERATION is set
there is a race condition between sed rewriting node_pb2.py and node_pb2_grpc.py and the `git diff`'s from check-source causing the prebuild CI step to fail with: ``` --- a/contrib/pyln-grpc-proto/pyln/grpc/node_pb2_grpc.py +++ b/contrib/pyln-grpc-proto/pyln/grpc/node_pb2_grpc.py @@ -3,7 +3,7 @@ import grpc import warnings -from pyln.grpc import node_pb2 as node__pb2 +import node_pb2 as node__pb2 ``` Changelog-None
1 parent d7b0f1f commit ba7da33

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,10 @@ ifneq ($V,1)
425425
MSGGEN_ARGS := -s
426426
endif
427427

428+
ifneq ($(SUPPRESS_GENERATION),1)
428429
$(MSGGEN_GENALL)&: contrib/msggen/msggen/schema.json
429430
@$(call VERBOSE, "msggen $@", PYTHONPATH=contrib/msggen $(PYTHON) contrib/msggen/msggen/__main__.py $(MSGGEN_ARGS) generate)
431+
endif
430432

431433
# The compiler assumes that the proto files are in the same
432434
# directory structure as the generated files will be. Since we
@@ -441,11 +443,13 @@ GRPC_GEN = \
441443

442444
ALL_TEST_GEN += $(GRPC_GEN)
443445

446+
ifneq ($(SUPPRESS_GENERATION),1)
444447
$(GRPC_GEN) &: cln-grpc/proto/node.proto cln-grpc/proto/primitives.proto
445448
$(PYTHON) -m grpc_tools.protoc -I cln-grpc/proto cln-grpc/proto/node.proto --python_out=$(GRPC_PATH)/ --grpc_python_out=$(GRPC_PATH)/ --experimental_allow_proto3_optional
446449
$(PYTHON) -m grpc_tools.protoc -I cln-grpc/proto cln-grpc/proto/primitives.proto --python_out=$(GRPC_PATH)/ --experimental_allow_proto3_optional
447450
find $(GRPC_DIR)/ -type f -name "*.py" -print0 | xargs -0 $(SED) -i'.bak' -e 's/^import \(.*\)_pb2 as .*__pb2/from pyln.grpc import \1_pb2 as \1__pb2/g'
448451
find $(GRPC_DIR)/ -type f -name "*.py.bak" -print0 | xargs -0 rm -f
452+
endif
449453

450454
# We make pretty much everything depend on these.
451455
ALL_GEN_HEADERS := $(filter %gen.h,$(ALL_C_HEADERS))

0 commit comments

Comments
 (0)