From abcfda133f33a4898e7ab210dd44cb2e3acace39 Mon Sep 17 00:00:00 2001 From: Shahana Farooqui Date: Sat, 15 Jul 2023 14:12:59 +0930 Subject: [PATCH] plugin: On-boarding default python plugins plugin: On-boarding default python plugins --- Makefile | 9 +++++++-- plugins/Makefile | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 66c724e8e..c42b4318d 100644 --- a/Makefile +++ b/Makefile @@ -793,11 +793,12 @@ installdirs: # $(PLUGINS) is defined in plugins/Makefile. -install-program: installdirs $(BIN_PROGRAMS) $(PKGLIBEXEC_PROGRAMS) $(PLUGINS) +install-program: installdirs $(BIN_PROGRAMS) $(PKGLIBEXEC_PROGRAMS) $(PLUGINS) $(PY_PLUGINS) @$(NORMAL_INSTALL) $(INSTALL_PROGRAM) $(BIN_PROGRAMS) $(DESTDIR)$(bindir) $(INSTALL_PROGRAM) $(PKGLIBEXEC_PROGRAMS) $(DESTDIR)$(pkglibexecdir) [ -z "$(PLUGINS)" ] || $(INSTALL_PROGRAM) $(PLUGINS) $(DESTDIR)$(plugindir) + for PY in $(PY_PLUGINS); do DIR=`dirname $$PY`; $(INSTALL_PROGRAM) $$DIR/*.py $(DESTDIR)$(plugindir)/`basename $$DIR`; done MAN1PAGES = $(filter %.1,$(MANPAGES)) MAN5PAGES = $(filter %.5,$(MANPAGES)) @@ -832,7 +833,7 @@ TESTBINS = \ # version of `lightningd` leading to bogus results. We bundle up all # built artefacts here, and will unpack them on the tester (overlaying # on top of the checked out repo as if we had just built it in place). -testpack.tar.bz2: $(BIN_PROGRAMS) $(PKGLIBEXEC_PROGRAMS) $(PLUGINS) $(MAN1PAGES) $(MAN5PAGES) $(MAN7PAGES) $(MAN8PAGES) $(DOC_DATA) config.vars $(TESTBINS) $(DEVTOOLS) +testpack.tar.bz2: $(BIN_PROGRAMS) $(PKGLIBEXEC_PROGRAMS) $(PLUGINS) $(PY_PLUGINS) $(MAN1PAGES) $(MAN5PAGES) $(MAN7PAGES) $(MAN8PAGES) $(DOC_DATA) config.vars $(TESTBINS) $(DEVTOOLS) tar -caf $@ $^ uninstall: @@ -845,6 +846,10 @@ uninstall: $(ECHO) rm -f $(DESTDIR)$(plugindir)/`basename $$f`; \ rm -f $(DESTDIR)$(plugindir)/`basename $$f`; \ done + @for f in $(PY_PLUGINS); do \ + $(ECHO) rm -rf $(DESTDIR)$(plugindir)/$$(basename $$(dirname $$f)); \ + rm -rf $(DESTDIR)$(plugindir)/$$(basename $$(dirname $$f)); \ + done @for f in $(PKGLIBEXEC_PROGRAMS); do \ $(ECHO) rm -f $(DESTDIR)$(pkglibexecdir)/`basename $$f`; \ rm -f $(DESTDIR)$(pkglibexecdir)/`basename $$f`; \ diff --git a/plugins/Makefile b/plugins/Makefile index 59823721d..85d9e1d83 100644 --- a/plugins/Makefile +++ b/plugins/Makefile @@ -102,12 +102,16 @@ C_PLUGINS := \ plugins/txprepare \ plugins/spenderp +PY_PLUGINS := \ + plugins/clnrest/clnrest.py + ifeq ($(HAVE_SQLITE3),1) C_PLUGINS += plugins/sql PLUGIN_ALL_SRC += $(PLUGIN_SQL_SRC) PLUGIN_ALL_HEADER += $(PLUGIN_SQL_HEADER) endif +# This is non-python plugins (PY_PLUGINS need their whole directory!) PLUGINS := $(C_PLUGINS) PLUGIN_ALL_OBJS := $(PLUGIN_ALL_SRC:.c=.o) @@ -227,8 +231,10 @@ plugins/sql: $(PLUGIN_SQL_OBJS) $(PLUGIN_LIB_OBJS) $(PLUGIN_COMMON_OBJS) $(JSMN_ # Generated from PLUGINS definition in plugins/Makefile ALL_C_HEADERS += plugins/list_of_builtin_plugins_gen.h +PLUGIN_BASES := $(PLUGINS:plugins/%=%) $(PY_PLUGINS:plugins/%=%) + plugins/list_of_builtin_plugins_gen.h: plugins/Makefile Makefile config.vars - @$(call VERBOSE,GEN $@,echo "static const char *list_of_builtin_plugins[] = { $(foreach d,$(notdir $(PLUGINS)),\"$d\",) NULL };" > $@) + @$(call VERBOSE,GEN $@,echo "static const char *list_of_builtin_plugins[] = { $(PLUGIN_BASES:%=\"%\",) NULL };" > $@) CLN_PLUGIN_EXAMPLES := \ target/${RUST_PROFILE}/examples/cln-plugin-startup \