Skip to content

Commit

Permalink
Makefile: generate and install requirements.txt files for Python plug…
Browse files Browse the repository at this point in the history
…ins.

Doesn't automate the install, but at least provides some tools for users
to install the requirements on their systems

See-also: #7665
Signed-off-by: Rusty Russell <[email protected]>
  • Loading branch information
rustyrussell committed Nov 24, 2024
1 parent 11580df commit d7ad639
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -800,10 +800,10 @@ installdirs:

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

install-program: installdirs $(BIN_PROGRAMS) $(PKGLIBEXEC_PROGRAMS) $(PLUGINS) $(PY_PLUGINS)
install-program: installdirs $(BIN_PROGRAMS) $(PKGLIBEXEC_PROGRAMS) $(PLUGINS) $(PY_PLUGINS) $(PLUGIN_REQUIREMENTS_TXT)
@$(NORMAL_INSTALL)
$(INSTALL_PROGRAM) $(BIN_PROGRAMS) $(DESTDIR)$(bindir)
$(INSTALL_PROGRAM) $(PKGLIBEXEC_PROGRAMS) $(DESTDIR)$(pkglibexecdir)
$(INSTALL_PROGRAM) $(PKGLIBEXEC_PROGRAMS) $(PLUGIN_REQUIREMENTS_TXT) $(DESTDIR)$(pkglibexecdir)
[ -z "$(PLUGINS)" ] || $(INSTALL_PROGRAM) $(PLUGINS) $(DESTDIR)$(plugindir)
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

Expand Down Expand Up @@ -882,6 +882,10 @@ uninstall:
$(ECHO) rm -f $(DESTDIR)$(docdir)/`basename $$f`; \
rm -f $(DESTDIR)$(docdir)/`basename $$f`; \
done
@for f in $(PLUGIN_REQUIREMENTS_TXT); do \
$(ECHO) rm -f $(DESTDIR)$(pkglibexecdir)/`basename $$f`; \
rm -f $(DESTDIR)$(pkglibexecdir)/`basename $$f`; \
done

installcheck: all-programs
@rm -rf testinstall || true
Expand Down
2 changes: 2 additions & 0 deletions plugins/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ recover
cln-askrene
recklessrpc
exposesecret
clnrest-requirements.txt
wss-proxy-requirements.txt
13 changes: 13 additions & 0 deletions plugins/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,21 @@ ifneq ($(RUST),0)
DEFAULT_TARGETS += $(CLN_PLUGIN_EXAMPLES) plugins/cln-grpc
endif

ifneq ($(NO_PYTHON), 1)
PLUGIN_REQUIREMENTS_TXT := plugins/wss-proxy-requirements.txt plugins/clnrest-requirements.txt
plugins/wss-proxy-requirements.txt: plugins/wss-proxy/pyproject.toml plugins/wss-proxy/poetry.lock
cd plugins/wss-proxy && poetry export --without-hashes > ../../$@


plugins/clnrest-requirements.txt: plugins/clnrest/pyproject.toml plugins/clnrest/poetry.lock
cd plugins/clnrest && poetry export --without-hashes > ../../$@

all-programs: $(PLUGIN_REQUIREMENTS_TXT)
endif

clean: plugins-clean
plugins-clean:
$(RM) $(PLUGIN_REQUIREMENTS_TXT)
$(RM) $(PLUGINS) $(CLN_PLUGIN_EXAMPLES)
$(RM) plugins/sql-schema_gen.h

Expand Down

0 comments on commit d7ad639

Please sign in to comment.