It was decided in december to add support for this alternative build process in numpy (1.0.5), but that it would be kept as a separate package for the time being. The package is called numscons, and is available on launchpad:
Numpy uses its own extension to distutils to build itself, and is also used by many code using numpy (scipy, most scikits). Unfortunately, distutils is not really flexible as a general build system (controlling build options in a fine grained manner is extremely ackward, no autoconf-like checks), and worse, the distutils code is difficult to extend or modify. Instead of adding functionalities to distutils, I suggested using scons as a build engine, called from distutils. The idea is to use call scons from distutils, and use sconscripts (sconscripts are to scons what makefiles are to make) to build extension. As scons is itself written in python, and sconscripts are mostly python scripts, it is a natural candidate.
Some of the stated goals:
- benefit from all the scons goodies, including automatic dependency checking, controling build options (warning flags, etc...) in a fine-grained manner, using rpath, etc...
- provides a serie of builders for commonly used extensions: ctypes-based extensions, pure C based extensions, SWIG-based extensions, etc...
- provide a support library to check for performances library (ATLAS, MKL, Sunperf, etc...), and making it easy to add your own.
- provides a support library to check for systeme capabilities (replacing system_info).
- fortran support.
It is hoped that this system is both easier to understand/hack and more robust than the actual system. See also this email on Numpy ML.
Getting the code
You need two things: basic support for scons in numpy.distutils, and the package numscons. The scons support for numpy.distutils is now merged in the development trunk (and will be included in the 1.0.5 release):
svn co http://svn.scipy.org/svn/numpy/trunk
numscons tarballs are available at:
Trying the code
Building numpy with scons
You can simply do as before, that is
python setupscons.py install
Since scons supports parrallel builds, you can also try:
python setupscons.py scons --jobs=2 install
Where 2 means try at most 2 compilation at the same time. See also CustomizingNumpyScons for more control (for MKL, sunperf, ATLAS support...)
Using scons command in your own modules
The main goal of numpy.scons is to make it easier to build extensions. Examples can be found at the page [NumpySconsExtExamples].
The following are known problems:
- IOError: [Errno 2] No such file or directory: (snip) .sconsign.dblite': this one is caused by a SConscript which calls GetNumpyEnvironment?, but which builds nothing. I am not sure yet if this is a scons bug or distutils.scons problem
Some basic design documentation can be found in the doc directory of numscons.