diff options
author | David Cournapeau <cournape@gmail.com> | 2011-08-20 23:47:48 +0200 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2011-08-29 00:32:27 +0200 |
commit | 6b1783791d0fcb5d4b5177a699d73f988179862f (patch) | |
tree | 19a2942b52309c0bc0c2c5c5394beacf89db5bbd /numpy | |
parent | 9346bc6c69c297607efea9eb5a951e44dbe861f4 (diff) | |
download | numpy-6b1783791d0fcb5d4b5177a699d73f988179862f.tar.gz |
ENH: write conf defines comments when test failed as well.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/build_utils/waf.py | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/numpy/build_utils/waf.py b/numpy/build_utils/waf.py index 5d4a263f2..41d63bc85 100644 --- a/numpy/build_utils/waf.py +++ b/numpy/build_utils/waf.py @@ -36,6 +36,10 @@ def validate_arguments(self, kw): if not 'errmsg' in kw: kw['errmsg'] = 'no !' + if 'define_name' in kw: + comment = kw.get('define_comment', None) + self.undefine_with_comment(kw['define_name'], comment) + def try_compile(self, kw): self.start_msg(kw["msg"]) ret = None @@ -418,6 +422,17 @@ def define_with_comment(conf, define, value, comment=None, quote=True): return conf.define(define, value, quote) @waflib.Configure.conf +def undefine_with_comment(conf, define, comment=None): + if comment is None: + return conf.undefine(define) + + comment_tbl = conf.env[DEFINE_COMMENTS] or {} + comment_tbl[define] = comment + conf.env[DEFINE_COMMENTS] = comment_tbl + + conf.undefine(define) + +@waflib.Configure.conf def get_comment(self, key): assert key and isinstance(key, str) @@ -456,11 +471,11 @@ def get_config_header(self, defines=True, headers=False): if defines: for x in self.env[DEFKEYS]: + cmt = self.get_comment(x) + if cmt is not None: + lst.append(cmt) if self.is_defined(x): val = self.get_define(x) - cmt = self.get_comment(x) - if cmt is not None: - lst.append(cmt) lst.append('#define %s %s\n' % (x, val)) else: lst.append('/* #undef %s */\n' % x) |