[ccan] Using ccan with a C python extension

Naveen Nathan naveen at lastninja.net
Tue Jun 16 11:01:21 AEST 2015


> >         I think you should use autoconf, as it's the standard.  I keep
> > hoping someone will write the autotools stuff for CCAN for me :)

Yep, autotools for ccan makes sense, certainly a lot easier to work with
than the current ad-hoc configure program which also needs compilation.
I want to explore this option further.

> Yeah, the trouble with that approach is that autoconf does a pretty poor
> job of integrating into Python module builds.
> 
> The usual build system in Python is the `distutils` module, which
> basically gets included into a Python script called 'setup.py' and called.
> 
> Then it's a *magic happens here* affair, where out the other end is your
> Python module.
> 
> You'd have to hook something in that could call ./configure at the
> appropriate time, and somehow convince the automated packaging tools
> (stdeb, gsourcery-pypi, etc) to ignore ./configure and use setup.py.
> 
> I'm not sure what's needed in config.h; maybe there's some way to
> generate this using some basic Python calls before building?

Agreed. I'm looking at the pycrypto project [1] which seems to run
'configure' when building the extension in the setup.py. I like this
idea since it is a clear separation of projects and the extension author
has far more control over the build process and can rely on the standard
syntax of autoconf projects.

[1] https://www.dlitz.net/software/pycrypto/


More information about the ccan mailing list