summaryrefslogtreecommitdiff
path: root/numpy/lib/bscript
blob: 03e36ce3117a6bdf0b8be01a0501ad49c95a2c2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import os

from bento.commands.hooks \
    import \
        pre_build

@pre_build()
def pbuild(context):
    bld = context.waf_context
    # FIXME: bento command's context should have API so that subclasses can
    # customize recurse behavior
    # XXX: there is a risk of confusion between waf Node class and our own:
    # mixing them is a big no no, and may cause very hard to debug issues.
    # Find a solution
    old_path = bld.path
    bld.path = old_path.find_dir(context.local_node.path_from(context.top_node))
    assert bld.path.__class__ == old_path.__class__

    # FIXME: there has to be a better way to refer to numpy/core include
    includes = [
            os.path.join(bld.srcnode.path_from(bld.path), "numpy/core"),
            os.path.join(bld.srcnode.path_from(bld.path), "numpy/core/include"),
            os.path.join(bld.srcnode.path_from(bld.path), "numpy/core/include/numpy"),
            os.path.join(bld.srcnode.path_from(bld.path), "numpy/core/src/private")]

    def builder_compiled_base(bld, extension):
        bld(features="c cshlib pyext",
            target=extension.name,
            includes=includes,
            source=extension.sources)
    context.register_builder("_compiled_base", builder_compiled_base)

    bld.path = old_path