summaryrefslogtreecommitdiff
path: root/numpy/linalg/bscript
blob: ade32a932ff8a3a36ee10781980d78d6c857b9af (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
34
35
import os

from bento.commands.hooks \
    import \
        pre_build

@pre_build()
def pbuild(context):
    bld = context.waf_context
    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 build_lapack_lite(bld, extension):
        kw = {}
        if bld.env.HAS_LAPACK:
            for s in ['python_xerbla.c', 'zlapack_lite.c', 'dlapack_lite.c',
                      'blas_lite.c', 'dlamch.c', 'f2c_lite.c']:
                extension.sources.pop(extension.sources.index(s))
            kw["uselib"] = "LAPACK"

        bld(features="c cshlib pyext",
            target=extension.name,
            source=extension.sources,
            includes=includes, **kw)
    context.register_builder("lapack_lite", build_lapack_lite)

    bld.path = old_path