[Numpy-discussion] RFC: add a install_clib numpy.distutils command to install pure C libraries

David Cournapeau cournape at gmail.com
Wed Jul 8 07:30:35 EDT 2009


On Fri, Jun 12, 2009 at 7:46 PM, David
Cournapeau<david at ar.media.kyoto-u.ac.jp> wrote:
> Hi,
>
>    I have finally spent some time so that we can install pure C
> libraries using numpy.distutils. With this, one could imagine having a C
> library for fft, special functions in numpy or scipy, so that the
> library could be reused in another package at the C level. If someone
> knowledgeable about numpy.distutils would like to review this branch, I
> would be grateful:

I reworked the branch, making it simpler to add installable libraries,
and ensuring it works for both conventional install and in-place
builds. The design is better, I believe:

 - libraries are installed through the add_installed_library function,
which is like add_library but with an install_dir argument
 - build_clib now takes an in-place argument (so that installable
libraries can be reused from an in-place build)
 - retrieving build info has been totally redesigned. Instead of
hardcoding it, I know use .ini file for each installable library, with
a syntax similar to .pc files as used by pkg-config.
 - build information to reuse the installable libraries is through the
get_info function, which returns a dict compatible with the extra_info
argument of add_library/add_extension.

The main change is thus the .ini file. The infrastructure could be
used to replace the rather inflexible system_info at some point. It
does not support every option of pkg-config, but it can handle
dependencies. For example, npymath depends on the math library, so
querying the libs option of npymath will automatically pull out the
libs option of the mlib as well. They can also be queried from the
command line:

python numpy/distutils/npy_pkg_config npymath --cflags
python numpy/distutils/npy_pkg_config npymath --libs

So that non distutils-based build systems can retrieve the info easily
(cmake, in particular).

I think it would be nice to have this in 1.4.0, so that we can rely on
npymath in scipy, and I need this for windows 64 bits support,

cheers,

David



More information about the NumPy-Discussion mailing list