Build: python agent: use setup.py over autoconf
authorJonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Mon, 10 Aug 2015 18:45:34 +0000 (14:45 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 11 Aug 2015 16:13:04 +0000 (12:13 -0400)
This change provides a valid way of installing the agent. The autoconf
python macro provides the wrong installation path for
python 3 under Debian and Ubuntu due to distro-specific packaging for
python 2.7 and 3.

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
.gitignore
configure.ac
liblttng-ust-python-agent/Makefile.am
liblttng-ust-python-agent/__init__.py.in [deleted file]
liblttng-ust-python-agent/lttngust/__init__.py.in [new file with mode: 0644]
liblttng-ust-python-agent/setup.py.in [new file with mode: 0644]

index 6b11c673c3f5a9e69c9d8fbb4d952276560545c1..4fe8607eede8dcd8d4e133e9e83d5010c5767aa9 100644 (file)
@@ -64,5 +64,8 @@ org_lttng_ust_agent_log4j_LTTngLogAppender.h
 liblttng-ust-java-agent/java/liblttng-ust-jul.jar
 
 # Python agent
-liblttng-ust-python-agent/__init__.py
+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
index 431a3ce83c23bf3a669ffba9be202f7496417f95..f29a4d207c068b225cbd4c026c3361a748f6e16a 100644 (file)
@@ -391,6 +391,8 @@ 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
        tools/Makefile
        tests/Makefile
        tests/hello/Makefile
@@ -402,6 +404,14 @@ AC_CONFIG_FILES([
        lttng-ust.pc
 ])
 
+# 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
+])
+
 AC_OUTPUT
 
 AS_ECHO()
index 869add4878632c9c4a46c22964a19a20d83db33e..f80b8a3f04a026cb7eba5ee2d2747c930477ab8a 100644 (file)
@@ -1,24 +1,3 @@
-# inputs/outputs
-LTTNGUST_PY_PACKAGE_DIR = $(srcdir)/lttngust
-LTTNGUST_PY_PACKAGE_FILES = agent.py cmd.py debug.py loghandler.py
-LTTNGUST_PY_PACKAGE_SRC = \
-       $(addprefix $(LTTNGUST_PY_PACKAGE_DIR)/,$(LTTNGUST_PY_PACKAGE_FILES))
-INIT_PY_IN = $(srcdir)/__init__.py.in
-INIT_PY = __init__.py
-
-# dist files
-EXTRA_DIST = $(INIT_PY_IN) $(LTTNGUST_PY_PACKAGE_SRC)
-
-# __init__.py with proper version string
-all-local: $(INIT_PY)
-
-$(INIT_PY): $(INIT_PY_IN)
-       $(SED) "s/@LTTNG_UST_VERSION@/$(PACKAGE_VERSION)/g" < $< > $@
-
-# Python package
-nodist_lttngust_PYTHON = $(LTTNGUST_PY_PACKAGE_SRC) $(INIT_PY)
-lttngustdir = $(pythondir)/lttngust
-
 # tracepoint provider
 AM_CPPFLAGS = $(PYTHON_INCLUDE) -I$(top_srcdir)/include/ \
        -I$(top_builddir)/include/
@@ -28,4 +7,28 @@ 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
 
-CLEANFILES = $(INIT_PY)
+# 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:
+       if [ "$(DESTDIR)" = "" ]; then \
+               $(PYTHON) setup.py install --prefix=$(prefix) --record install_files.txt  --verbose --no-compile $(DISTSETUPOPTS);  \
+       else \
+               $(PYTHON) setup.py install --root=$(DESTDIR) --verbose install_files.txt  --prefix=$(prefix) --no-compile $(DISTSETUPOPTS); \
+       fi
+clean-local:
+       rm -rf build
+
+uninstall-local:
+       cat install_files.txt | xargs rm -rf
+       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/__init__.py.in b/liblttng-ust-python-agent/__init__.py.in
deleted file mode 100644 (file)
index 0b83d10..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2015 - Philippe Proulx <pproulx@efficios.com>
-#
-# This library is free software; you can redistribute it and/or modify it under
-# the terms of the GNU Lesser General Public License as published by the Free
-# Software Foundation; version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
-# details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with this library; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
-
-from __future__ import unicode_literals
-
-# this creates the daemon threads and registers the application
-import lttngust.agent
-
-
-__version__ = '@LTTNG_UST_VERSION@'
diff --git a/liblttng-ust-python-agent/lttngust/__init__.py.in b/liblttng-ust-python-agent/lttngust/__init__.py.in
new file mode 100644 (file)
index 0000000..b70c2e8
--- /dev/null
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2015 - Philippe Proulx <pproulx@efficios.com>
+#
+# This library is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+
+from __future__ import unicode_literals
+
+# this creates the daemon threads and registers the application
+import lttngust.agent
+
+
+__version__ = '@PACKAGE_VERSION@'
diff --git a/liblttng-ust-python-agent/setup.py.in b/liblttng-ust-python-agent/setup.py.in
new file mode 100644 (file)
index 0000000..7f21c5c
--- /dev/null
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2015 - Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
+#
+# This library is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; version 2.1 of the License.
+#
+# This library is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
+
+from distutils.core import setup, Extension
+
+setup(name='lttngust',
+      version='@PACKAGE_VERSION@',
+      description='Lttng ust agent',
+      packages=['lttngust'],
+      package_dir={'lttngust': 'lttngust'},
+      options={'build': {'build_base': 'build'}})
This page took 0.029666 seconds and 4 git commands to generate.