[SciPy-Dev] Numpy and Scipy build with bento

Pauli Virtanen pav@iki...
Fri Jun 17 18:47:20 CDT 2011

On Fri, 17 Jun 2011 08:12:48 +0900, David Cournapeau wrote:
> To try it, just get the bento_waf_build branch of scipy (on
> github.com/cournape/scipy.git), and follow the instructions in

Seems to work nicely. Strange to see how much faster the compilation
feels with four cores :)


Some questions on waf integration and general strategy of Bento:


Can it be made work so that I can type

    ./waf <some-command>

This probably could be done with shipping some stuff in bento providing
a boilerplate wscript, and would probably also solve the issue of
supplying WAF_DIR.


Do you think it would make sense to make the bscript part of Bento
stupider, and invert the control flow?

That is, one could have the build driven by wscripts instead of bscripts.
The wscripts would then just have something like:

    # scipy/wscript:

    import bento.bentowaf as bentowaf

    def configure(ctx):
        # custom stuff ...

    def build(ctx):

    def install(ctx):

    # scipy/optimize/wscript:

    import bento.bentowaf as bentowaf

    def build(ctx):
        items = bentowaf.get_items(ctx)

        # here, we need to do some nonstandard stuff with the builders
        for name in ['_lbfgsb', '_cobyla', 'minpack2', '_nnls', '_slsqp']:
            item = items.pop(name)
            ctx(features="c pyext bento cshlib f2py",
                use="minpack rootfind FLAPACK CLIB")

        # the rest are to be built with default options
        bentowaf.build_items(ctx, items)

Similarly, one could imagine a Makefile-driven build:

    # Makefile

    configure: configure-stamp

        bentomaker configure $(CONFIGURE_ARGS)
        touch configure-stamp

    build: build-stamp

    build-stamp: configure-stamp some_extension.so
        touch build-stamp

    install: build-stamp
        bentomaker install $(INSTALL_ARGS)

    build_egg: build-stamp
        bentomaker build_egg

    some_extension.so: $(shell bentomaker get-sources some_extension)
        gcc $(shell bentomaker get-python-cflags) -o $@ $^
        cp -f $@ $(shell bentomaker get-target some_extensions)

    .PHONY: configure build install build_egg

I'm shooting from the hip. Do I forget something (you've obviously
put more thought into this)?


More information about the SciPy-Dev mailing list