diff options
author | David Cournapeau <cournape@gmail.com> | 2011-03-15 11:39:15 -0400 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2011-08-29 00:32:23 +0200 |
commit | aa7e9bda76003fa4b9843de02b949d211a0c858c (patch) | |
tree | 40266281f3c10fc5ec3982a673f8a6bc0aa5b81c /bscript | |
parent | 992b4a79e00f48ea85e7fa5d3413bda999b20918 (diff) | |
download | numpy-aa7e9bda76003fa4b9843de02b949d211a0c858c.tar.gz |
FEAT: numpy.core and numpy.lib both build
Diffstat (limited to 'bscript')
-rw-r--r-- | bscript | 60 |
1 files changed, 59 insertions, 1 deletions
@@ -1,4 +1,5 @@ import sys +import shutil # Ugly but necessary hack: import numpy here so that wscript in sub directories # will see this numpy and not an already installed one @@ -7,11 +8,13 @@ __builtin__.__NUMPY_SETUP__ = True from bento.commands.hooks \ import \ - pre_configure + pre_configure, post_build from bento.commands.extras.waf \ import \ ConfigureWafContext, BuildWafContext +import waflib + def check_blas_lapack(conf): conf.env.HAS_CBLAS = False if sys.platform == "win32": @@ -56,8 +59,63 @@ def configure(context): conf.env.CC = ["/usr/bin/gcc-4.0"] conf.env.LINK_CC = ["/usr/bin/gcc-4.0"] + conf.env.CFLAGS_PYEXT.append("-Wfatal-errors") check_blas_lapack(conf) +# FIXME: abstract those module gen tasks... +class write_module(waflib.Task.Task): + color = "CYAN" + vars = ["CONTENT"] + def run(self): + # FIXME: put actual data here + self.outputs[0].write(self.env.CONTENT) + +@waflib.TaskGen.feature("gen_pymodule") +def process_write_config(self): + if not hasattr(self, "content"): + raise ValueError("task gen %r expects a 'content' argument" % self.name) + else: + self.env.CONTENT = self.content + tsk = self.create_task("write_module") + tsk.set_outputs(self.path.find_or_declare(self.target)) + return tsk + +@post_build() +def pbuild(context): + bld = context.waf_context + + bld(features="gen_pymodule", + target="numpy/__config__.py", + content="""\ +def show(): + pass +""", + always=True) + bld(features="gen_pymodule", + target="numpy/version.py", + content="""\ +git_revision = "" +version = "" +""", + always=True) + bld.compile() + + # Poor man's and temporary replacement for in-place build + if "-i" in sys.argv: + for g in bld.groups: + for task_gen in g: + if hasattr(task_gen, "link_task"): + ltask = task_gen.link_task + for output in ltask.outputs: + if output.is_child_of(bld.bldnode): + shutil.copy(output.abspath(), output.path_from(bld.bldnode)) + elif "gen_pymodule" in task_gen.features: + if len(task_gen.tasks) > 0: + task = task_gen.tasks[0] + for output in task.outputs: + if output.is_child_of(bld.bldnode): + shutil.copy(output.abspath(), output.path_from(bld.bldnode)) + def startup(context): context.register_context("configure", ConfigureWafContext) context.register_context("build", BuildWafContext) |