Progress migrating cffi and pycparser to libclang

Paul Moore p.f.moore at gmail.com
Thu Jan 4 06:41:43 EST 2018


On 4 January 2018 at 09:50, Etienne Robillard <tkadm30 at yandex.com> wrote:
> Hi,
>
> I will be creating a repository for this:
> https://bitbucket.org/tkadm30/cffi-libclang
>
> The goal is to generate a AST object from a C header by preprocessing with
> clang -E then compile the python bindings with CFFI...
>
> ffi.cdef(open('uwsgi.h').read()) # <-- XXX need to modify internal parsing
> code to use clang.cindex!
>
> ffi.dlopen('/usr/local/lib/libuwsgi.so')
>
>
> Right now the parsing of the C source file is done by pycparser, but i would
> like to use the clang.cindex module.
>
> What do you think?

Presumably that will introduce a dependency on some clang module? You
mention clang.cindex - but the only clang package I can find on PyPI
says "OBSOLETE. LLVM-CLANG NOW PUBLISHES PYTHON PACKAGE.
JUST ADD THE OFFICIAL llvm-3.7 repo in your apt." but doesn't provide
binaries or explain how to install clang on, say, Windows (to pick an
example relevant to me :-)).

As a fork/extension for cffi, I have no particular opinion (I'm
unlikely to ever use it). But the advantage of pycparser is that it's
cross-platform and pure Python, so I doubt this will be acceptable for
inclusion into CFFI itself.

Paul



More information about the Python-list mailing list