[Numpy-discussion] Bitting the bullet: using scons to build extensions inside distutils ?

David Cournapeau cournape@gmail....
Sat Sep 15 13:41:41 CDT 2007


   Starting thinking over the whole distutils thing, I was thinking
what people would think about using scons inside distutils to build
extension. The more I think about it, the more I think than distutils
not being maintained, and numpy/scipy building needs being much more
complicated (at least different) than usual python extension, trying
to circumvent distutils problems is an ever ending fight. Scons, being
developped as a Make replacement, can do all we would like to be able
to do with distutils, including:
 - building shared or static libraries, with dependencies (knows how
to do it on many platforms).
 - can build each object file independently (e.g different compiler options)
 - is much much friendlier than distutils.
 - can handle external tools like swig, etc...
 - have basic facility to look for libraries (ala autoconf. By basic,
I mean it is far from being as complete as autoconf, but is much
better than distutils).

Scons has also the following advantages:
 - written in python, can be distributed with numpy (by this, I mean
AFAIK, license-wise, it is ok, and its size is not big): does not add
additional dependency.
 - can be called within distutils quite easily.

That is, I don't see big disadvantage to use it with distutils. It
would give use some wanted features out of the box (building
extensions based on ctypes, much friendlier way to customize building

There are some things I am not sure about :
 - how to build python extension with it: this is of course mandatory
 - what is required for a "bi-directional" communication with
distutils: for this to work, distutils needs to be aware of what scons
builds (for things like bdist to work, for example).

There is no question this will require some work. But anyway, my
feeling is there is a need to improve the distutils thing, and I feel
like this may be an easier path than patching over distutils
defficiencies. I know scons quite a bit, and am willing to develop at
least a prototype to see the feasibility of the whole thing.

But before starting, I would like to know whether other find the idea
attractive, dumb, is a waste of time, etc...



More information about the Numpy-discussion mailing list