On Thu, Oct 20, 2005 at 11:22:32AM +0200, Torsten Marek wrote: > Hello all, Hello. > > I've posted the first version of the Python bindings to the apt-front list, > but > it seems that I should have better posted it here. > > I'm making some progress, although it's rather slow due to some obnoxious > errors > I encounter, which I'll explain in another mail (some of them seem to be SWIG > bugs, though). > > As already said, there are problems with nested classes/structs in SWIG, and > as > long as those are not cared for, the affected structs and methods handling > with > them have to be guarded by #ifdef symbols, which are defined when SWIG > preprocesses the headers. > There were also some syntactic peculiarities that SWIG could not handle, they > are also guarded. > In the patch for libtagcoll, I had to exchange > > Expression operator and (const Expression& e); > Expression operator or (const Expression& e); > Expression operator not (); > > with > Expression operator&& (const Expression& e); > Expression operator|| (const Expression& e); > Expression operator! (); > > which works perfectly, since the former are only alii for the latter. > Enrico, I've attached a patch included all changes made to tagcoll. It surely does work, but it makes the api a bit less clear :'/. I wish swig would have get fixed in this case (again).
> For apt-front, it's mostly the same, only more. > * in cache/component/tags.h, I had to make facetData(...) and tagData(...) > protected, otherwise the SWIG code generator would fail. I'm wondering why it can't remain public? What does swig do? Since they aren't virtual (or i didn't notice?), maybe they could be completely left out for swig instead? [snip iterator stuff -- not relevant anymore] > This is an excerpt from my other email to apt-front-devel: > I've created a distutils script, but the SWIG C++ support in distutils from > Python 2.4 still has some problems, so the code is generated manually as of > now. Hmm, isn't automake supposed to be able to handle that? I don't know, just would think so. If no, well, i guess we can live with distutils in there. Just please make sure those things are done in swig/python, not in swig/. Also, i'd like to ask you to move python-specific code into python.i, as it was before. If we are already going with swig, we may as well do it cleanly enough to support say ruby or other language bindings. Same for testing or otherwise .py scripts, those belong to swig/python/. > The script debtags.py tries to mimic the behaviour of the debtags binary to > show > how the Python interface works. As of now, I'll try to implement the behaviour > of the actions listed at the end of debtags.py and fix the problems as the > occur. Then I'm going to look at the rest of apt-front. Please note that the > old > scripts from swig/python will not work, since both the apt-front interface and > the Python interface have changed. Yes, sure, no problem with that :). > I'm also planning to split the Python interface into modules and hide some of > the classes the user does not instantiate directly. > === > The code for the SWIG bindings is available here: > http://diotavelli.net/files/apt-front-swig-python.tar.bz2 > > There are still a lot of rough edges (like the naming of instantiated > templates), but if you want to see what works already, have a look at > debtags.py. > > If you want to build the Python bindings, just patch the headers of apt-front > and tagcoll. No recompilation is needed. > > Bug reports, comments, suggestions welcome. Apart from the above remarks, i guess you have done good job, even if python is not my favorite programming language =). However, if i find time, i will reuse your work here to revive the ruby bindings i suppose. They may, in the end, be of some use, even if only for myself :). Thanks again for working on this. I would also like to start merging this into svn, do you have an alioth account and do you have access to the project? I could of course merge it myself, but i'd prefer you to work directly in svn in the future, so we don't get too desynchronized... > greetings > Torsten Yours, Peter. -- Peter Rockai | me()mornfall!net | prockai()redhat!com | +421907533216 http://blog.mornfall.net | http://web.mornfall.net "In My Egotistical Opinion, most people's C programs should be indented six feet downward and covered with dirt." -- Blair P. Houghton on the subject of C program indentation _______________________________________________ Debtags-devel mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/debtags-devel

