From 5b6ff569c0bf82b72f263a259e7a73a453903648 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Fri, 27 Nov 2015 12:39:51 -0500 Subject: [PATCH] Refactor Python agent build and install Since the Python agent's tracepoint provider, liblttng-ust-python-agent, does not depend on Python, it can always be built and installed alongside LTTng-UST. The Python package of this agent is completely independent from the rest of the tree, thus it is isolated in its own directory. This also eases the creation of distribution packages because the packager can selectively build and install the Python package without also building/installing the tracepoint provider. Signed-off-by: Philippe Proulx Signed-off-by: Mathieu Desnoyers --- .gitignore | 9 +++--- Makefile.am | 3 +- configure.ac | 13 ++++---- liblttng-ust-python-agent/Makefile.am | 30 ++----------------- python-lttngust/Makefile.am | 25 ++++++++++++++++ .../lttngust/__init__.py.in | 0 .../lttngust/agent.py | 0 .../lttngust/cmd.py | 0 .../lttngust/debug.py | 0 .../lttngust/loghandler.py | 0 .../setup.py.in | 0 11 files changed, 40 insertions(+), 40 deletions(-) create mode 100644 python-lttngust/Makefile.am rename {liblttng-ust-python-agent => python-lttngust}/lttngust/__init__.py.in (100%) rename {liblttng-ust-python-agent => python-lttngust}/lttngust/agent.py (100%) rename {liblttng-ust-python-agent => python-lttngust}/lttngust/cmd.py (100%) rename {liblttng-ust-python-agent => python-lttngust}/lttngust/debug.py (100%) rename {liblttng-ust-python-agent => python-lttngust}/lttngust/loghandler.py (100%) rename {liblttng-ust-python-agent => python-lttngust}/setup.py.in (100%) diff --git a/.gitignore b/.gitignore index 41966c5d..287d9e7a 100644 --- a/.gitignore +++ b/.gitignore @@ -65,8 +65,7 @@ org_lttng_ust_agent_jul_LttngLogHandler.h org_lttng_ust_agent_log4j_LttngLogAppender.h # Python agent -liblttng-ust-python-agent/lttngust/__init__.py -liblttng-ust-python-agent/**/*.pyc -liblttng-ust-python-agent/build -liblttng-ust-python-agent/install_files.txt -liblttng-ust-python-agent/setup.py +python-lttngust/lttngust/__init__.py +python-lttngust/**/*.pyc +python-lttngust/build +python-lttngust/setup.py diff --git a/Makefile.am b/Makefile.am index 16663eef..5bb53112 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,6 +6,7 @@ SUBDIRS = . include snprintf libringbuffer liblttng-ust-comm \ liblttng-ust-fork \ liblttng-ust-libc-wrapper \ liblttng-ust-cyg-profile \ + liblttng-ust-python-agent \ tools if HAVE_DLINFO @@ -21,7 +22,7 @@ SUBDIRS += liblttng-ust-java-agent endif if BUILD_PYTHON_AGENT -SUBDIRS += liblttng-ust-python-agent +SUBDIRS += python-lttngust endif SUBDIRS += tests doc diff --git a/configure.ac b/configure.ac index cd92e192..26bf5a59 100644 --- a/configure.ac +++ b/configure.ac @@ -394,8 +394,9 @@ AC_CONFIG_FILES([ liblttng-ust-libc-wrapper/Makefile liblttng-ust-cyg-profile/Makefile liblttng-ust-python-agent/Makefile - liblttng-ust-python-agent/setup.py - liblttng-ust-python-agent/lttngust/__init__.py + python-lttngust/Makefile + python-lttngust/setup.py + python-lttngust/lttngust/__init__.py tools/Makefile tests/Makefile tests/hello/Makefile @@ -410,10 +411,10 @@ AC_CONFIG_FILES([ # Create link for python agent for the VPATH guru. AC_CONFIG_LINKS([ - liblttng-ust-python-agent/lttngust/agent.py:liblttng-ust-python-agent/lttngust/agent.py - liblttng-ust-python-agent/lttngust/cmd.py:liblttng-ust-python-agent/lttngust/cmd.py - liblttng-ust-python-agent/lttngust/debug.py:liblttng-ust-python-agent/lttngust/debug.py - liblttng-ust-python-agent/lttngust/loghandler.py:liblttng-ust-python-agent/lttngust/loghandler.py + python-lttngust/lttngust/agent.py:python-lttngust/lttngust/agent.py + python-lttngust/lttngust/cmd.py:python-lttngust/lttngust/cmd.py + python-lttngust/lttngust/debug.py:python-lttngust/lttngust/debug.py + python-lttngust/lttngust/loghandler.py:python-lttngust/lttngust/loghandler.py ]) AC_OUTPUT diff --git a/liblttng-ust-python-agent/Makefile.am b/liblttng-ust-python-agent/Makefile.am index e2a15f48..726ffe4e 100644 --- a/liblttng-ust-python-agent/Makefile.am +++ b/liblttng-ust-python-agent/Makefile.am @@ -1,34 +1,8 @@ -# tracepoint provider -AM_CPPFLAGS = $(PYTHON_INCLUDE) -I$(top_srcdir)/include/ \ +# tracepoint provider: always built/installed (does not depend on Python per se) +AM_CPPFLAGS = -I$(top_srcdir)/include/ \ -I$(top_builddir)/include/ AM_CFLAGS = -fno-strict-aliasing lib_LTLIBRARIES = liblttng-ust-python-agent.la liblttng_ust_python_agent_la_SOURCES = lttng_ust_python.c lttng_ust_python.h liblttng_ust_python_agent_la_LIBADD = -lc -llttng-ust \ -L$(top_builddir)/liblttng-ust/.libs - -# Use setup.py for the installation instead of Autoconf. -# This ease the installation process and assure a *pythonic* -# installation. -agent_path=lttngust -all-local: - $(PYTHON) setup.py build --verbose - -install-exec-local: - @opts="--prefix=$(prefix) --verbose --no-compile $(DISTSETUPOPTS)"; \ - if [ "$(DESTDIR)" != "" ]; then \ - opts="$$opts --root=$(DESTDIR)"; \ - fi; \ - $(PYTHON) setup.py install $$opts; - -clean-local: - rm -rf build - -uninstall-local: - rm -rf $(DESTDIR)$(pkgpythondir) - -EXTRA_DIST=$(agent_path) - -# Remove automake generated file before dist -dist-hook: - rm -rf $(distdir)/$(agent_path)/__init__.py diff --git a/python-lttngust/Makefile.am b/python-lttngust/Makefile.am new file mode 100644 index 00000000..cc289895 --- /dev/null +++ b/python-lttngust/Makefile.am @@ -0,0 +1,25 @@ +# Use setup.py for the installation instead of Autoconf. +# This ease the installation process and assure a *pythonic* +# installation. +agent_path=lttngust +all-local: + $(PYTHON) setup.py build --verbose + +install-exec-local: + @opts="--prefix=$(prefix) --verbose --no-compile $(DISTSETUPOPTS)"; \ + if [ "$(DESTDIR)" != "" ]; then \ + opts="$$opts --root=$(DESTDIR)"; \ + fi; \ + $(PYTHON) setup.py install $$opts; + +clean-local: + rm -rf build + +uninstall-local: + rm -rf $(DESTDIR)$(pkgpythondir) + +EXTRA_DIST=$(agent_path) + +# Remove automake generated file before dist +dist-hook: + rm -rf $(distdir)/$(agent_path)/__init__.py diff --git a/liblttng-ust-python-agent/lttngust/__init__.py.in b/python-lttngust/lttngust/__init__.py.in similarity index 100% rename from liblttng-ust-python-agent/lttngust/__init__.py.in rename to python-lttngust/lttngust/__init__.py.in diff --git a/liblttng-ust-python-agent/lttngust/agent.py b/python-lttngust/lttngust/agent.py similarity index 100% rename from liblttng-ust-python-agent/lttngust/agent.py rename to python-lttngust/lttngust/agent.py diff --git a/liblttng-ust-python-agent/lttngust/cmd.py b/python-lttngust/lttngust/cmd.py similarity index 100% rename from liblttng-ust-python-agent/lttngust/cmd.py rename to python-lttngust/lttngust/cmd.py diff --git a/liblttng-ust-python-agent/lttngust/debug.py b/python-lttngust/lttngust/debug.py similarity index 100% rename from liblttng-ust-python-agent/lttngust/debug.py rename to python-lttngust/lttngust/debug.py diff --git a/liblttng-ust-python-agent/lttngust/loghandler.py b/python-lttngust/lttngust/loghandler.py similarity index 100% rename from liblttng-ust-python-agent/lttngust/loghandler.py rename to python-lttngust/lttngust/loghandler.py diff --git a/liblttng-ust-python-agent/setup.py.in b/python-lttngust/setup.py.in similarity index 100% rename from liblttng-ust-python-agent/setup.py.in rename to python-lttngust/setup.py.in -- 2.34.1