[lttng-dev] [lttng-tools PATCH] lttng-tools python module
Christian Babeux
christian.babeux at efficios.com
Tue Jul 31 15:56:47 EDT 2012
Hi Danny,
First of all, thank you for your work on Python bindings!
This will be very useful in the near future :).
Here are some comments on your patch:
> SWIG >= 2.0 is used to create the wrapper and its
> 'warning md variable unused' bug is patched in Makefile.am.
> [...]
> diff --git a/src/python/Makefile.am b/src/python/Makefile.am
> new file mode 100644
> index 0000000..b67d550
> --- /dev/null
> +++ b/src/python/Makefile.am
> [...]
> +lttng_wrap.c: lttng.i
> + $(SWIG) -python -I. -I$(top_srcdir)/src/common/sessiond-comm
lttng.i
> + sed -i "s/Python.h/python$(PYTHON_VERSION)\/Python.h/g"
lttng_wrap.c
> + sed -i "s/PyObject \*m, \*d, \*md;/PyObject \*m, \*d;\n#if
defined(SWIGPYTHON_BUILTIN)\nPyObject *md;\n#endif/g" lttng_wrap.c
> + sed -i "s/md = d/d/g" lttng_wrap.c
> + sed -i "s/(void)public_symbol;/(void)public_symbol;\n md = d;/g"
lttng_wrap.c
If I understand correctly your commit message, those sed invocations are
necessary to remove an 'unused variable warning'. Is this a known upstream
bug in SWIG?
> + sed -i "s/Python.h/python$(PYTHON_VERSION)\/Python.h/g"
lttng_wrap.c
This sed replacement didn't work on my machine. I have a Python3 install
and
the appropriate Python.h header is located in '/usr/include/python3.2mu'.
To reliably detect Python include paths, the 'python-config --includes'
command can be used like you did in the main configure.ac.
I would suggest generating the binding like this:
-AM_CFLAGS = -I$(PYTHONINC) -I../lib/lttng-ctl -I../common \
+AM_CFLAGS = -I$(PYTHON_INCLUDE) -I../lib/lttng-ctl -I../common \
$(BUDDY_CFLAGS)
[...]
lttng_wrap.c: lttng.i
$(SWIG) -python -I. -I$(top_srcdir)/src/common/sessiond-comm lttng.i
- sed -i "s/Python.h/python$(PYTHON_VERSION)\/Python.h/g" lttng_wrap.c
[...]
The README should also mention that in order to generate
the Python bindings, python headers are also required
(python-dev on Debian/Ubuntu).
Thank you,
Christian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lttng.org/pipermail/lttng-dev/attachments/20120731/2620188c/attachment.html>
More information about the lttng-dev
mailing list