Disable defines by setting define_name='' #1766

This commit is contained in:
Thomas Nagy 2016-07-08 19:39:05 +02:00
parent 1201a7776f
commit cdb46e29f9
No known key found for this signature in database
GPG Key ID: 49B4C67C05277AAA
1 changed files with 10 additions and 7 deletions

View File

@ -653,7 +653,7 @@ def post_check(self, *k, **kw):
else:
is_success = (kw['success'] == 0)
if 'define_name' in kw:
if kw.get('define_name'):
# TODO this is still way too complicated
comment = kw.get('comment', '')
define_name = kw['define_name']
@ -829,8 +829,9 @@ def define(self, key, val, quote=True, comment=''):
:param quote: enclose strings in quotes (yes by default)
:type quote: bool
"""
assert key and isinstance(key, str)
assert isinstance(key, str)
if not key:
return
if val is True:
val = 1
elif val in (False, None):
@ -862,8 +863,9 @@ def undefine(self, key, comment=''):
:param key: define name
:type key: string
"""
assert key and isinstance(key, str)
assert isinstance(key, str)
if not key:
return
ban = key + '='
lst = [x for x in self.env.DEFINES if not x.startswith(ban)]
self.env.DEFINES = lst
@ -886,8 +888,9 @@ def define_cond(self, key, val, comment=''):
:param val: value
:type val: int or string
"""
assert key and isinstance(key, str)
assert isinstance(key, str)
if not key:
return
if val:
self.define(key, 1, comment=comment)
else: