[PyKDE] Any tools to generate sip files?
I've been looking at trying to generate python bindings for the libmythlibrary which is part of the mythtv pvr project (http://www.mythtv.org) I was wondering if there where any tools to automate the generation of the.sip files from the .h files instead of doing it manually?
RE: [PyKDE] Any tools to generate sip files?
On 13-Mar-03 Hubbard, Dwight wrote: > I've been looking at trying to generate python bindings for the > libmyth > library which is part of the mythtv pvr project ( > http://www.mythtv.org) > I was wondering if there where any tools to automate the > generation of the .sip files from the .h files instead of doing > it manually? Almost. I have a tool in development that does automatic h->sip conversion, as well has generating the build scripts and writing some of the docs. I'm using it to generate the next PyKDE version and it's essentially complete enough to do that (ignoring the occasional bug that still pops up now and then). I haven't tried it on anything except PyKDE, so I'm sure there'll be problems with it, particularly in generating the build stuff. I took a quick look at the libmyth sources and only see one problem - one of the h files has a "using" statement, which is one of the few things I'm not planning on supporting. You'd have to add explicit scoping manually to the variables covered by that statement. I didn't see any place where you'd need to hand write any C++ code for sip, but I only took a quick look. I also didn't check to see what beyond the libmyth h files you'd need sip files for. If libmyth references objects in other libs, you'd need to bind those too or else hide the references somehow (Qt isn't a problem however). The other nice feature of this tool and sip is that they handle versioning - you can build a new set of sip files from the previous version's sip files and the new h files. It looks like this project will be changing fairly rapidly at the moment. If you have a strong urge to be a guinea pig for undocumented and probably somewhat buggy incomplete software, I can send you a tarball (it's all in Python). Basically all you should need to do is create a project file (assuming it works). You'd also need Python 2.2.2, sip 3.5 and PyQt 3.5 (since libmyth is Qt based). This is far from releaseable, but works pretty well. If it works, you'd have sip files in about 20 seconds (all of PyKDE takes about 3 1/2 minutes). There's a strong chance this will be completely useless to you. Otherwise, I can take a look at it myself when I get some time. Jim ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
RE: [PyKDE] Any tools to generate sip files?
I took a second very quick look at the libmyth sources, and there's good news and bad news: the good news is the "using" statement is for 'std' (always make me think of "sexually transmitted disease"), so you won't have to do any explicit scoping. The bad new is that you'll have to hand write mapped type code for all instances of templates from std (but only if they're public or protected - you can ignore all of the private stuff). It's not that hard to do though, and instead of vector<> you'll get a Python list in the bindings. Jim ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
Re: [PyKDE] Any tools to generate sip files?
On conversion tools topic, I am also writing a tool to convert more broadly cpp -> pyqt/pykde (don't ask me why I need that :). Reading your post, the thought occured that I may be reinventing the wheel right now. Hence, anybody aware if such a cpp2py tool already exists? Secondly, I'd also like to have a look at your 'h2sip' tool, if posible. Cheers, Vio Jim Bublitz wrote: On 13-Mar-03 Hubbard, Dwight wrote: I've been looking at trying to generate python bindings for the libmyth library which is part of the mythtv pvr project ( http://www.mythtv.org) I was wondering if there where any tools to automate the generation of the .sip files from the .h files instead of doing it manually? Almost. I have a tool in development that does automatic h->sip conversion, as well has generating the build scripts and writing some of the docs. I'm using it to generate the next PyKDE version and it's essentially complete enough to do that (ignoring the occasional bug that still pops up now and then). I haven't tried it on anything except PyKDE, so I'm sure there'll be problems with it, particularly in generating the build stuff. I took a quick look at the libmyth sources and only see one problem - one of the h files has a "using" statement, which is one of the few things I'm not planning on supporting. You'd have to add explicit scoping manually to the variables covered by that statement. I didn't see any place where you'd need to hand write any C++ code for sip, but I only took a quick look. I also didn't check to see what beyond the libmyth h files you'd need sip files for. If libmyth references objects in other libs, you'd need to bind those too or else hide the references somehow (Qt isn't a problem however). The other nice feature of this tool and sip is that they handle versioning - you can build a new set of sip files from the previous version's sip files and the new h files. It looks like this project will be changing fairly rapidly at the moment. If you have a strong urge to be a guinea pig for undocumented and probably somewhat buggy incomplete software, I can send you a tarball (it's all in Python). Basically all you should need to do is create a project file (assuming it works). You'd also need Python 2.2.2, sip 3.5 and PyQt 3.5 (since libmyth is Qt based). This is far from releaseable, but works pretty well. If it works, you'd have sip files in about 20 seconds (all of PyKDE takes about 3 1/2 minutes). There's a strong chance this will be completely useless to you. Otherwise, I can take a look at it myself when I get some time. Jim ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
Re: [PyKDE] Any tools to generate sip files?
On 13-Mar-03 Vio wrote: > On conversion tools topic, I am also writing a tool to convert > more broadly cpp -> pyqt/pykde (don't ask me why I need that :). > Reading your post, the thought occured that I may be > reinventing the wheel right now. Hence, anybody aware if such a > cpp2py tool already exists? I haven't ever looked for one - not aware of any. > Secondly, I'd also like to have a look at your 'h2sip' tool, if > posible. Sure. I'll package up a tarball (and try to remember to put switches around the KDE specific stuff) and write up a brief README. I'll try to get to it this weekend. It uses a handwritten predictive parser, and the tokenizer is subclassed from the Python Tokenizer module. I've found it pretty easy to extend/modify, but then again it's my code - YMMV. It might be possible to extend it to cpp, but the stuff that handles expressions and preprocessor stuff is really crappy at the moment (don't need much of that for PyKDE h files fortunately). The way it stores data would be a nightmare for translating code (you can't really look up a symbol in the symbol table very easily, for example, unless you already know its scope, version, signature, etc). However, that stuff is pretty well decoupled from the parser and could be replaced without a lot of trouble. Without giving it a lot of thought, I'd look at outputting some intermediate code (like XML) and then working from that. The tarball will probably run about 130K after endoding for email. If you can't handle an attachment that size, let me know. Otherwise I'll send you a copy in a few days. If anyone else is curious, let me know. This isn't high quality software at the moment. Jim ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
[PyKDE] PyKDE Status and Update
PyKDE is (finally) starting to progress. I mentioned earlier that I'm revising the entire process and have most of that done now (at least well enough to start actually generating code). So far, I've built 3 versions (2.1.1 -> 2.2.0) and will be starting on 2.2.1 in a few minutes. Starting over from 2.1.1 will give me a much cleaner code base. I've also picked up quite a few unnoticed bugs and a few missing classes/methods/etc by revising the entire process. This is also the last release to support KDE2.x.x, so I'd like it to be fairly clean. In addition, I've started on adding some better demo stuff and testing, and also started on including some templates and examples for writing code with PyKDE. The doc format has been revised and expanded a little (it's now a little more Python oriented than before). There's still a lot to do in all of those areas that probably won't make it into this release. Lastly, I've set up a couple of multi-boot machines so I can test every version (2.1.1->3.1.0) and also test building on RH 8.0 and Mandrake 9.0 in addition to SuSE 7.3/8.0/8.1, with several Qt versions and several Python versions as well. There won't be a lot of apparent changes, but under the hood this should be a much better piece of software. As for a release date -- as always it's "a few weeks" away. Jim ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
[PyKDE] Error in building qscintilla 20030309 snapshot
I am getting the following error under Windows with Visual Studio .Net: C:\qscintilla-1.51-win-commercial-snapshot-20030309\qt>nmake Microsoft (R) Program Maintenance Utility Version 7.00.9466 Copyright (C) Microsoft Corporation. All rights reserved. cl -c -nologo -Zm200 -W0 -MD -O1 -DQEXTSCINTILLA_MAKE_DLL -DQT -DSCI_LE XER -DQT_DLL -DQT_THREAD_SUPPORT -DQT_NO_DEBUG -I"." -I"..\include" -I"..\src" - I"C:\Qt\3.1.1\include" -I"C:\Qt\3.1.1\mkspecs\win32-msvc.net" -Fo @c:\TMP\nm68E. tmp qextscintilla.cxx qextscintilla.cxx(178) : error C2057: expected constant expression qextscintilla.cxx(178) : error C2466: cannot allocate an array of constant size 0 qextscintilla.cxx(178) : error C2133: 'word' : unknown size NMAKE : fatal error U1077: 'cl' : return code '0x2' Stop. Thanks -Selim Selim Tuvi, Research Engineering Group, SLAC GLAST, I&T Online, MS 98 Tel:650-926-3376 Fax:650-926-4335 ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
Re: [PyKDE] Any tools to generate sip files?
Well that's essentially what SIP is, although it's more than just cpp->pyqt/kde, it's cpp->python in general. Along the same lines, has anybody checked out Boost.Python by any chance? It's pretty awesome. The folks at Boost are insane. http://www.boost.org/libs/python/doc/index.html Fred On Thursday 13 March 2003 15:16, Vio wrote: > On conversion tools topic, I am also writing a tool to convert more > broadly cpp -> pyqt/pykde (don't ask me why I need that :). Reading your > post, the thought occured that I may be reinventing the wheel right now. > Hence, anybody aware if such a cpp2py tool already exists? > > Secondly, I'd also like to have a look at your 'h2sip' tool, if posible. > > Cheers, > Vio ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
Re: [PyKDE] Any tools to generate sip files?
On 14-Mar-03 Frederick Polgardy Jr wrote: > Well that's essentially what SIP is, although it's more than just > cpp->pyqt/kde, it's cpp->python in general. I took him to mean he wanted to translate (line for line) C++ into python, for example: if (something) { x = 1 y = 2 } to if something: x = 1 y = 2 which is not what sip does. Sip provides an interface to C++ libs on the binary level - it has no idea what's in the cpp code, but only knows what the call/return interface to the code is (hence sip only needs to look at the h files, not the cpp files - mostly). The bindings sip produces are in C++, not Python. > Along the same lines, has anybody checked out Boost.Python by any > chance? It's pretty awesome. The folks at Boost are insane. > http://www.boost.org/libs/python/doc/index.html I've looked at it (and argued with David Abrams on comp.lang.python a little) but never tried it. Boost has some advantages over sip, especially if you only want to bind a few functions, have a lot of templates, or like writing C++. The drawbacks (in the context of of a large project like PyKDE anyway) is that it requires a lot of handwritten code, more knowledge of what the code actually does, looks difficult to automate, and would be difficult to maintain over a number of versions (right now PyQt supports everything from Qt1.42 onward, and PyKDE supports KDE 2.1.1 onward, each with a single file set). Can't say as far as performance, but it seems like Boost should be pretty fast and perhaps a little smaller in binary size. Jim ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
Re: [PyKDE] Any tools to generate sip files?
Thanks for the Boost tip. Am looking into it as I write this. Ok, perhaps I should have been more specific, more like: anyone aware of a tool for converting cpp 'source code' to python (or pyqt or pykde) 'source code', the tool itself ideally written in python (though not necessarily, of course). Sorry for being so python-biased :) Vio Frederick Polgardy Jr wrote: Well that's essentially what SIP is, although it's more than just cpp->pyqt/kde, it's cpp->python in general. Along the same lines, has anybody checked out Boost.Python by any chance? It's pretty awesome. The folks at Boost are insane. http://www.boost.org/libs/python/doc/index.html Fred On Thursday 13 March 2003 15:16, Vio wrote: On conversion tools topic, I am also writing a tool to convert more broadly cpp -> pyqt/pykde (don't ask me why I need that :). Reading your post, the thought occured that I may be reinventing the wheel right now. Hence, anybody aware if such a cpp2py tool already exists? Secondly, I'd also like to have a look at your 'h2sip' tool, if posible. Cheers, Vio ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde
Re: [PyKDE] Any tools to generate sip files?
Jim Bublitz wrote: On 14-Mar-03 Frederick Polgardy Jr wrote: Well that's essentially what SIP is, although it's more than just cpp->pyqt/kde, it's cpp->python in general. I took him to mean he wanted to translate (line for line) C++ into python, for example: if (something) { x = 1 y = 2 } to if something: x = 1 y = 2 Exactly. Well, for the time being, writing such a scanner isn't "too" painful, at least with the tool I'm using right now (Plex1.1.4), only, of course, if somebody already handled this problem before me somehow, I would hate to re-invent the wheel once again :) Cheers, Vio ___ PyKDE mailing list[EMAIL PROTECTED] http://mats.gmd.de/mailman/listinfo/pykde