mirror of https://gitlab.com/ita1024/waf.git
let conf.define() cast bool and None values to int
This commit is contained in:
parent
d2d31c69a0
commit
ec3295c1a4
|
@ -779,7 +779,7 @@ def check_cc(self, *k, **kw):
|
|||
@conf
|
||||
def define(self, key, val, quote=True):
|
||||
"""
|
||||
Store a single define and its state into conf.env.DEFINES
|
||||
Store a single define and its state into conf.env.DEFINES. If the value is True, False or None it is cast to 1 or 0.
|
||||
|
||||
:param key: define name
|
||||
:type key: string
|
||||
|
@ -790,6 +790,11 @@ def define(self, key, val, quote=True):
|
|||
"""
|
||||
assert key and isinstance(key, str)
|
||||
|
||||
if val is True:
|
||||
val = 1
|
||||
elif val in (False, None):
|
||||
val = 0
|
||||
|
||||
if isinstance(val, int) or isinstance(val, float):
|
||||
s = '%s=%s'
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue