Skip to content

Commit

Permalink
REF: use simpler API in top bscript.
Browse files Browse the repository at this point in the history
We use the new register_outputs_simple + remove some redundant code.
  • Loading branch information
cournape committed May 31, 2012
1 parent fc466d4 commit 87295b3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
17 changes: 4 additions & 13 deletions bscript
Original file line number Diff line number Diff line change
Expand Up @@ -105,29 +105,20 @@ def make_git_commit_info(ctx):
commit_template = ctx.make_source_node(op.join("numpy", "version.py.in"))
return set_revision(commit_template, ctx.pkg.version)

@hooks.pre_configure
def pre_configure(context):
@hooks.post_configure
def post_configure(context):
conf = context.waf_context

conf.load("compiler_c")
conf.load("custom_python", tooldir=[waf_backend.WAF_TOOLDIR])

conf.check_python_version((2, 4, 0))
conf.check_python_headers()

if conf.env["CC_NAME"] == "gcc":
conf.env.CFLAGS_PYEXT.append("-Wfatal-errors")
check_blas_lapack(conf)

@hooks.pre_build
def pre_build(context):
context.register_category("git_info")
commit_output = make_git_commit_info(context)
context.register_outputs("git_info", "git_commit_info", [commit_output])
context.register_outputs_simple([commit_output])

# FIXME: we write a dummy show for now - the original show function is not
# super useful anyway.
context.register_category("gen_config")
config_node = context.make_build_node("numpy/__config__.py")
config_node.safe_write("def show(): pass")
context.register_outputs("gen_config", "top_config", [config_node])
context.register_outputs_simple([config_node])
14 changes: 7 additions & 7 deletions numpy/core/bscript
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import os
import sys

from bento.commands.hooks \
import \
pre_configure, pre_build, post_build
from bento.commands import hooks

import waflib
import waflib.Errors
from waflib.Task \
Expand Down Expand Up @@ -263,8 +262,8 @@ def check_win32_specifics(conf):
if arch == "Intel" or arch == "AMD64":
conf.define('FORCE_NO_LONG_DOUBLE_FORMATTING', 1)

@pre_configure
def configure(context):
@hooks.post_configure
def post_configure(context):
conf = context.waf_context

try:
Expand Down Expand Up @@ -399,11 +398,12 @@ def process_umath_generator(self):
return tsk

from os.path import join as pjoin
@pre_build
def pbuild(context):
@hooks.pre_build
def pre_build(context):
bld = context.waf_context

context.register_category("numpy_gen_headers")

numpyconfig_h = context.local_node.declare(os.path.join("include", "numpy", "_numpyconfig.h"))
context.register_outputs("numpy_gen_headers", "numpyconfig", [numpyconfig_h])

Expand Down
2 changes: 1 addition & 1 deletion numpy/random/bscript
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import sys
from bento.commands import hooks
import waflib

@hooks.pre_configure
@hooks.post_configure
def configure(context):
conf = context.waf_context

Expand Down

0 comments on commit 87295b3

Please sign in to comment.