[Distutils] Python packaging + conditional use of C library shipped with the package
Gabriel de Perthuis
g2p.code at gmail.com
Mon Jul 8 13:32:31 CEST 2013
On Mon, 08 Jul 2013 13:01:25 +0200, Laurent Gautier wrote:
> I would like to make a package that is able to use a system's given
> C-library if found, or compile its own version shipped with the package.
> This is bringing up two questions:
> - Is there a distutils/distribute facility to help test for the presence
> (and version) of a C library, or do I have to roll my own system ?
No. Here is a rather clean script that encapsulates pkg-config:
> - When having the source for a C library shipping with a package, is
> there a way to get distutils/distribute compile it, and get it seen by
> Python at runtime (so I can just use ctypes, or cffi, and even C
> extensions in other Python package see the headers and compiled libraries) ?
I don't think you should do any kind of bundling.
That will easily decuple the complexity of your setup scripts,
for a subpar result. Point to the C project and let people
install it as they will.
More information about the Distutils-SIG