Skip to content

Commit

Permalink
Makefile: don't create .bak files only to delete them immediately after
Browse files Browse the repository at this point in the history
3a18d8b had the right idea, but
`sed -i` on macOS doesn't have to create backup files at all. The man
page says:

-i extension
    Edit files in-place, saving backups with the specified extension.
    If a zero-length extension is given, no backup will be saved.

So, we pass a zero-length extension to avoid creating backup files. Then
we don't have to delete any backups afterward.

Changelog-None
  • Loading branch information
whitslack committed Sep 21, 2023
1 parent 7cead08 commit 91d48c7
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,7 @@ ALL_TEST_GEN += $(GRPC_GEN)
$(GRPC_GEN)&: cln-grpc/proto/node.proto cln-grpc/proto/primitives.proto
$(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
$(PYTHON) -m grpc_tools.protoc -I cln-grpc/proto cln-grpc/proto/primitives.proto --python_out=$(GRPC_PATH)/ --experimental_allow_proto3_optional
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'
find $(GRPC_DIR)/ -type f -name "*.py.bak" -print0 | xargs -0 rm -f
find $(GRPC_DIR)/ -type f -name "*.py" -print0 | xargs -0 sed -i '' -e 's/^import \(.*\)_pb2 as .*__pb2/from pyln.grpc import \1_pb2 as \1__pb2/g'
endif

# We make pretty much everything depend on these.
Expand Down

0 comments on commit 91d48c7

Please sign in to comment.