better mandatory/empty support for mandatory_warnings

This commit is contained in:
2016-06-29 21:42:54 +02:00
parent 0c8398e4a6
commit 44d585a5e2
5 changed files with 87 additions and 10 deletions

View File

@ -391,9 +391,13 @@ class Settings(object):
is_cached, props = self._p_.getcache(path, ntime, index)
if not is_cached:
props = self._p_.getproperties(path, opt.impl_getproperties())
if opt.impl_is_multi() and not opt.impl_is_master_slaves('slave'):
props.add('empty')
if apply_requires:
props = copy(props)
props |= self.apply_requires(opt, path, setting_properties, index)
requires = self.apply_requires(opt, path, setting_properties, index)
if requires != set([]):
props = copy(props)
props |= requires
if 'cache' in setting_properties:
if 'expire' in setting_properties:
ntime = ntime + expires_time
@ -477,9 +481,8 @@ class Settings(object):
not self._getcontext().cfgimpl_get_values()._isempty(
opt_or_descr, value, index=index):
properties.remove('mandatory')
elif opt_or_descr.impl_is_multi() and \
elif 'empty' in properties and \
'empty' in setting_properties and \
not opt_or_descr.impl_is_master_slaves('slave') and \
self._getcontext().cfgimpl_get_values()._isempty(
opt_or_descr, value, force_allow_empty_list=True):
properties.add('mandatory')
@ -488,6 +491,8 @@ class Settings(object):
properties.add('frozen')
elif 'frozen' in properties and not check_frozen:
properties.remove('frozen')
if 'empty' in properties:
properties.remove('empty')
# at this point an option should not remain in properties
if properties != frozenset():
props = list(properties)