several corrections about dependency
This commit is contained in:
@ -42,10 +42,12 @@ del(sys)
|
||||
class CacheOptionDescription(BaseOption):
|
||||
__slots__ = ('_cache_paths', '_cache_consistencies', '_cache_force_store_values')
|
||||
|
||||
def impl_build_cache(self, config, path='', _consistencies=None,
|
||||
cache_option=None, force_store_values=None):
|
||||
def _build_cache(self, config, path='', _consistencies=None,
|
||||
cache_option=None, force_store_values=None,
|
||||
_dependencies=None):
|
||||
"""validate duplicate option and set option has readonly option
|
||||
"""
|
||||
# cache_option is None only when we start to build cache
|
||||
if cache_option is None:
|
||||
if self.impl_is_readonly():
|
||||
raise ConfigError(_('option description seems to be part of an other '
|
||||
@ -54,8 +56,10 @@ class CacheOptionDescription(BaseOption):
|
||||
_consistencies = {}
|
||||
cache_option = []
|
||||
force_store_values = []
|
||||
_dependencies = []
|
||||
else:
|
||||
init = False
|
||||
|
||||
for option in self._impl_getchildren(dyn=False):
|
||||
cache_option.append(option)
|
||||
if path == '':
|
||||
@ -63,19 +67,14 @@ class CacheOptionDescription(BaseOption):
|
||||
else:
|
||||
subpath = path + '.' + option.impl_getname()
|
||||
if isinstance(option, OptionDescription):
|
||||
option._set_readonly(False)
|
||||
option.impl_build_cache(config, subpath, _consistencies,
|
||||
cache_option, force_store_values)
|
||||
#cannot set multi option as OptionDescription requires
|
||||
option._set_readonly()
|
||||
option._build_cache(config, subpath, _consistencies,
|
||||
cache_option, force_store_values,
|
||||
_dependencies)
|
||||
else:
|
||||
if option.impl_is_master_slaves('master'):
|
||||
if not getattr(option, '_dependencies', None):
|
||||
options = set()
|
||||
else:
|
||||
options = set(option._dependencies)
|
||||
options.add(option.impl_get_master_slaves())
|
||||
option._dependencies = tuple(options)
|
||||
option._set_readonly(True)
|
||||
option._add_dependency(option.impl_get_master_slaves())
|
||||
option._set_readonly()
|
||||
is_multi = option.impl_is_multi()
|
||||
if not option._is_symlinkoption() and 'force_store_value' in option.impl_getproperties():
|
||||
force_store_values.append((subpath, option))
|
||||
@ -102,6 +101,9 @@ class CacheOptionDescription(BaseOption):
|
||||
[]).append((func,
|
||||
all_cons_opts,
|
||||
params))
|
||||
# if context is set to callback, must be reset each time a value change
|
||||
if hasattr(option, '_has_calc_context'):
|
||||
_dependencies.append(option)
|
||||
is_slave = None
|
||||
if is_multi:
|
||||
all_requires = option.impl_getrequires()
|
||||
@ -142,7 +144,9 @@ class CacheOptionDescription(BaseOption):
|
||||
opt.impl_getname()))
|
||||
self._cache_consistencies[opt] = tuple(cons)
|
||||
self._cache_force_store_values = force_store_values
|
||||
self._set_readonly(False)
|
||||
if _dependencies:
|
||||
self._dependencies = tuple(_dependencies)
|
||||
self._set_readonly()
|
||||
|
||||
def impl_already_build_caches(self):
|
||||
return getattr(self, '_cache_paths', None) is not None
|
||||
@ -171,7 +175,7 @@ class CacheOptionDescription(BaseOption):
|
||||
if value_set:
|
||||
config._impl_values._p_.commit()
|
||||
|
||||
def impl_build_cache_option(self, _currpath=None, cache_path=None,
|
||||
def _build_cache_option(self, _currpath=None, cache_path=None,
|
||||
cache_option=None):
|
||||
|
||||
if self.impl_is_readonly() or (_currpath is None and getattr(self, '_cache_paths', None) is not None):
|
||||
@ -192,7 +196,7 @@ class CacheOptionDescription(BaseOption):
|
||||
cache_path.append(path)
|
||||
if option.impl_is_optiondescription():
|
||||
_currpath.append(attr)
|
||||
option.impl_build_cache_option(_currpath, cache_path,
|
||||
option._build_cache_option(_currpath, cache_path,
|
||||
cache_option)
|
||||
_currpath.pop()
|
||||
if save:
|
||||
@ -471,7 +475,6 @@ class OptionDescription(OptionDescriptionWalk):
|
||||
": this option is not a multi"
|
||||
"").format(child.impl_getname(), self.impl_getname()))
|
||||
#length of master change slaves length
|
||||
self._set_has_dependency()
|
||||
MasterSlaves(self.impl_getname(), children)
|
||||
else: # pragma: optional cover
|
||||
raise ValueError(_('group_type: {0}'
|
||||
|
Reference in New Issue
Block a user