[Pyrex] defining module constants
Stefan Behnel
stefan_ml at behnel.de
Fri Apr 11 09:41:40 CEST 2008
Hi,
Rob Shortt wrote:
> I'm creating some python bindings to a C library. I've defined
> everything from the lib's header file in my pxd file and would like to
> expose many of the defined enums in my pyrex module, not as members of a
> class, but toplevel to my module.
What I did for lxml was to write a little script that parses the HTML
documentation of libxml2 (which would be the header file in your case) for
error state enums and write that directly into both a .pxi and a .pxd file.
They change from time to time with new releases of libxml2, so rerunning the
script gets them updated.
http://codespeak.net/svn/lxml/trunk/update-error-constants.py
http://codespeak.net/svn/lxml/trunk/src/lxml/xmlerror.pxd
http://codespeak.net/svn/lxml/trunk/src/lxml/xmlerror.pxi
Hope that helps,
Stefan
More information about the Pyrex
mailing list