Skip to content

Commit 17722fd

Browse files
rustyrussellvincenzopalazzo
authored andcommitted
Makefile: generate and install requirements.txt files for Python plugins.
Doesn't automate the install, but at least provides some tools for users to install the requirements on their systems See-also: #7665 Changelog-None: Makefile: generate and install requirements.txt files for Python plugins. Co-Developed-by: Vincenzo Palazzo <[email protected]> Signed-off-by: Rusty Russell <[email protected]>
1 parent 11580df commit 17722fd

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -800,10 +800,10 @@ installdirs:
800800

801801
# $(PLUGINS) is defined in plugins/Makefile.
802802

803-
install-program: installdirs $(BIN_PROGRAMS) $(PKGLIBEXEC_PROGRAMS) $(PLUGINS) $(PY_PLUGINS)
803+
install-program: installdirs $(BIN_PROGRAMS) $(PKGLIBEXEC_PROGRAMS) $(PLUGINS) $(PY_PLUGINS) $(PLUGIN_REQUIREMENTS_TXT)
804804
@$(NORMAL_INSTALL)
805805
$(INSTALL_PROGRAM) $(BIN_PROGRAMS) $(DESTDIR)$(bindir)
806-
$(INSTALL_PROGRAM) $(PKGLIBEXEC_PROGRAMS) $(DESTDIR)$(pkglibexecdir)
806+
$(INSTALL_PROGRAM) $(PKGLIBEXEC_PROGRAMS) $(PLUGIN_REQUIREMENTS_TXT) $(DESTDIR)$(pkglibexecdir)
807807
[ -z "$(PLUGINS)" ] || $(INSTALL_PROGRAM) $(PLUGINS) $(DESTDIR)$(plugindir)
808808
for PY in $(PY_PLUGINS); do DIR=`dirname $$PY`; DST=$(DESTDIR)$(plugindir)/`basename $$DIR`; if [ -d $$DST ]; then rm -rf $$DST; fi; $(INSTALL_PROGRAM) -d $$DIR; cp -a $$DIR $$DST ; done
809809

@@ -882,6 +882,10 @@ uninstall:
882882
$(ECHO) rm -f $(DESTDIR)$(docdir)/`basename $$f`; \
883883
rm -f $(DESTDIR)$(docdir)/`basename $$f`; \
884884
done
885+
@for f in $(PLUGIN_REQUIREMENTS_TXT); do \
886+
$(ECHO) rm -f $(DESTDIR)$(pkglibexecdir)/`basename $$f`; \
887+
rm -f $(DESTDIR)$(pkglibexecdir)/`basename $$f`; \
888+
done
885889

886890
installcheck: all-programs
887891
@rm -rf testinstall || true

plugins/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ recover
1919
cln-askrene
2020
recklessrpc
2121
exposesecret
22+
clnrest-requirements.txt
23+
wss-proxy-requirements.txt

plugins/Makefile

+13
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,21 @@ ifneq ($(RUST),0)
303303
DEFAULT_TARGETS += $(CLN_PLUGIN_EXAMPLES) plugins/cln-grpc
304304
endif
305305

306+
ifneq ($(NO_PYTHON), 1)
307+
PLUGIN_REQUIREMENTS_TXT := plugins/wss-proxy-requirements.txt plugins/clnrest-requirements.txt
308+
plugins/wss-proxy-requirements.txt: plugins/wss-proxy/pyproject.toml plugins/wss-proxy/poetry.lock
309+
cd plugins/wss-proxy && poetry export --without-hashes > ../../$@
310+
311+
312+
plugins/clnrest-requirements.txt: plugins/clnrest/pyproject.toml plugins/clnrest/poetry.lock
313+
cd plugins/clnrest && poetry export --without-hashes > ../../$@
314+
315+
all-programs: $(PLUGIN_REQUIREMENTS_TXT)
316+
endif
317+
306318
clean: plugins-clean
307319
plugins-clean:
320+
$(RM) $(PLUGIN_REQUIREMENTS_TXT)
308321
$(RM) $(PLUGINS) $(CLN_PLUGIN_EXAMPLES)
309322
$(RM) plugins/sql-schema_gen.h
310323

0 commit comments

Comments
 (0)