<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
<br><br><div><blockquote><hr id="stopSpelling">Date: Tue, 31 Jul 2012 15:56:47 -0400<br>Subject: Re: [lttng-dev] [lttng-tools PATCH] lttng-tools python module<br>From: christian.babeux@efficios.com<br>To: danny.serres@efficios.com<br>CC: lttng-dev@lists.lttng.org<br><br><div>Hi Danny,</div><div><br></div><div>First of all, thank you for your work on Python bindings!</div><div>This will be very useful in the near future :).</div><div><br></div><div>Here are some comments on your patch:</div><div><br></div><div>> SWIG >= 2.0 is used to create the wrapper and its</div><div>> 'warning md variable unused' bug is patched in Makefile.am.</div><div>> [...]</div><div>> diff --git a/src/python/Makefile.am b/src/python/Makefile.am</div><div>> new file mode 100644</div><div>> index 0000000..b67d550</div><div>> --- /dev/null</div><div>> +++ b/src/python/Makefile.am</div><div>> [...]</div><div>> +lttng_wrap.c: lttng.i</div><div>> +       $(SWIG) -python -I. -I$(top_srcdir)/src/common/sessiond-comm lttng.i</div><div>> +       sed -i "s/Python.h/python$(PYTHON_VERSION)\/Python.h/g" lttng_wrap.c</div><div>> +       sed -i "s/PyObject \*m, \*d, \*md;/PyObject \*m, \*d;\n#if defined(SWIGPYTHON_BUILTIN)\nPyObject *md;\n#endif/g" lttng_wrap.c</div><div>> +       sed -i "s/md = d/d/g" lttng_wrap.c</div><div>> +       sed -i "s/(void)public_symbol;/(void)public_symbol;\n  md = d;/g" lttng_wrap.c</div><div><br></div><div>If I understand correctly your commit message, those sed invocations are </div><div>necessary to remove an 'unused variable warning'. Is this a known upstream</div>bug in SWIG?<br></blockquote>









<div><br>Yes, it is.  So far, it has not been fixed but a patch has been proposed (same as I apply here using sed)<br>(see <a href="http://sourceforge.net/tracker/index.php?func=detail&aid=3530021&group_id=1645&atid=101645">http://sourceforge.net/tracker/index.php?func=detail&aid=3530021&group_id=1645&atid=101645</a> )<br></div><div><br></div><blockquote><div>> +       sed -i "s/Python.h/python$(PYTHON_VERSION)\/Python.h/g" lttng_wrap.c </div><div><br></div><div>This sed replacement didn't work on my machine. I have a Python3 install and </div><div>the appropriate Python.h header is located in '/usr/include/python3.2mu'.</div><div>To reliably detect Python include paths, the 'python-config --includes'</div><div>command can be used like you did in the main <a href="http://configure.ac" target="_blank">configure.ac</a>.<br><br></div><div>I would suggest generating the binding like this:</div><div><br></div><div>-AM_CFLAGS = -I$(PYTHONINC) -I../lib/lttng-ctl -I../common \     </div><div>+AM_CFLAGS = -I$(PYTHON_INCLUDE) -I../lib/lttng-ctl -I../common \</div><div>              $(BUDDY_CFLAGS)                                    </div><div>[...]</div><div> lttng_wrap.c: lttng.i</div><div>        $(SWIG) -python -I. -I$(top_srcdir)/src/common/sessiond-comm lttng.i</div><div>-       sed -i "s/Python.h/python$(PYTHON_VERSION)\/Python.h/g" lttng_wrap.c</div><div>[...]</div><div><br></div><div>The README should also mention that in order to generate </div><div>the Python bindings, python headers are also required </div><div>(python-dev on Debian/Ubuntu).<br></div></blockquote><div><br>Fixed.  I will post a second version soon.<br><br>Thanks,<br>Danny<br></div><div><br></div><blockquote><div><br></div><div>Thank you,</div><div><br></div><div>Christian</div></blockquote>









<div><br></div></div>                                     </div></body>
</html>