Compare commits
No commits in common. "686a218ed03a86f9e430be0b82c14bba3890d6e2" and "529bb1ae7d08bf1bbd273c43a92d3c3ed4173520" have entirely different histories.
686a218ed0
...
529bb1ae7d
|
@ -1,5 +1,4 @@
|
||||||
"""Rougail method
|
#from .loader import load
|
||||||
"""
|
|
||||||
from .rougail import Rougail
|
from .rougail import Rougail
|
||||||
from .annotator import modes
|
from .annotator import modes
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
"""Annotate check
|
"""Annotate check
|
||||||
"""
|
"""
|
||||||
|
from importlib.machinery import SourceFileLoader
|
||||||
from typing import List, Any
|
from typing import List, Any
|
||||||
|
|
||||||
from .variable import CONVERT_OPTION
|
from .variable import CONVERT_OPTION
|
||||||
|
|
||||||
from ..utils import load_modules
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from ..error import DictConsistencyError
|
from ..error import DictConsistencyError
|
||||||
|
|
||||||
|
@ -21,7 +21,8 @@ class CheckAnnotator:
|
||||||
not hasattr(objectspace.space.constraints, 'check'):
|
not hasattr(objectspace.space.constraints, 'check'):
|
||||||
return
|
return
|
||||||
self.objectspace = objectspace
|
self.objectspace = objectspace
|
||||||
self.functions = dir(load_modules(eosfunc_file))
|
eosfunc = SourceFileLoader('eosfunc', eosfunc_file).load_module()
|
||||||
|
self.functions = dir(eosfunc)
|
||||||
self.functions.extend(INTERNAL_FUNCTIONS)
|
self.functions.extend(INTERNAL_FUNCTIONS)
|
||||||
self.check_check()
|
self.check_check()
|
||||||
self.check_valid_enum()
|
self.check_valid_enum()
|
||||||
|
@ -40,7 +41,7 @@ class CheckAnnotator:
|
||||||
check_name = check.target
|
check_name = check.target
|
||||||
# let's replace the target by the an object
|
# let's replace the target by the an object
|
||||||
try:
|
try:
|
||||||
check.target = self.objectspace.paths.get_variable(check.target)
|
check.target = self.objectspace.paths.get_variable_obj(check.target)
|
||||||
except DictConsistencyError as err:
|
except DictConsistencyError as err:
|
||||||
if err.errno == 36:
|
if err.errno == 36:
|
||||||
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
|
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
|
||||||
|
@ -62,7 +63,7 @@ class CheckAnnotator:
|
||||||
param_option_indexes.append(idx)
|
param_option_indexes.append(idx)
|
||||||
else:
|
else:
|
||||||
# let's replace params by the path
|
# let's replace params by the path
|
||||||
param.text = self.objectspace.paths.get_variable(param.text)
|
param.text = self.objectspace.paths.get_variable_obj(param.text)
|
||||||
param_option_indexes.sort(reverse=True)
|
param_option_indexes.sort(reverse=True)
|
||||||
for idx in param_option_indexes:
|
for idx in param_option_indexes:
|
||||||
check.param.pop(idx)
|
check.param.pop(idx)
|
||||||
|
|
|
@ -85,7 +85,7 @@ class Conditionnnotator:
|
||||||
msg = _('target name and source name must be different: '
|
msg = _('target name and source name must be different: '
|
||||||
f'{condition.source}')
|
f'{condition.source}')
|
||||||
raise DictConsistencyError(msg, 11)
|
raise DictConsistencyError(msg, 11)
|
||||||
target.name = self.objectspace.paths.get_variable(target.name)
|
target.name = self.objectspace.paths.get_variable_obj(target.name)
|
||||||
elif target.type == 'family':
|
elif target.type == 'family':
|
||||||
target.name = self.objectspace.paths.get_family(target.name,
|
target.name = self.objectspace.paths.get_family(target.name,
|
||||||
condition.namespace,
|
condition.namespace,
|
||||||
|
@ -203,7 +203,7 @@ class Conditionnnotator:
|
||||||
"""
|
"""
|
||||||
for condition in self.objectspace.space.constraints.condition:
|
for condition in self.objectspace.space.constraints.condition:
|
||||||
try:
|
try:
|
||||||
condition.source = self.objectspace.paths.get_variable(condition.source)
|
condition.source = self.objectspace.paths.get_variable_obj(condition.source)
|
||||||
except DictConsistencyError as err:
|
except DictConsistencyError as err:
|
||||||
if err.errno == 36:
|
if err.errno == 36:
|
||||||
xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles)
|
xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles)
|
||||||
|
|
|
@ -169,7 +169,7 @@ class FamilyAnnotator:
|
||||||
for family in families.family.values():
|
for family in families.family.values():
|
||||||
if 'dynamic' not in vars(family):
|
if 'dynamic' not in vars(family):
|
||||||
continue
|
continue
|
||||||
family.dynamic = self.objectspace.paths.get_variable(family.dynamic)
|
family.dynamic = self.objectspace.paths.get_variable_obj(family.dynamic)
|
||||||
if not family.dynamic.multi:
|
if not family.dynamic.multi:
|
||||||
xmlfiles = self.objectspace.display_xmlfiles(family.xmlfiles)
|
xmlfiles = self.objectspace.display_xmlfiles(family.xmlfiles)
|
||||||
msg = _(f'dynamic family "{family.name}" must be linked '
|
msg = _(f'dynamic family "{family.name}" must be linked '
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
"""Fill annotator
|
"""Fill annotator
|
||||||
"""
|
"""
|
||||||
from ..utils import load_modules
|
from importlib.machinery import SourceFileLoader
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
|
|
||||||
from ..error import DictConsistencyError
|
from ..error import DictConsistencyError
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,7 +18,8 @@ class FillAnnotator:
|
||||||
if not hasattr(objectspace.space, 'constraints') or \
|
if not hasattr(objectspace.space, 'constraints') or \
|
||||||
not hasattr(self.objectspace.space.constraints, 'fill'):
|
not hasattr(self.objectspace.space.constraints, 'fill'):
|
||||||
return
|
return
|
||||||
self.functions = dir(load_modules(eosfunc_file))
|
eosfunc = SourceFileLoader('eosfunc', eosfunc_file).load_module()
|
||||||
|
self.functions = dir(eosfunc)
|
||||||
self.convert_fill()
|
self.convert_fill()
|
||||||
|
|
||||||
def convert_fill(self) -> None:
|
def convert_fill(self) -> None:
|
||||||
|
@ -49,7 +52,7 @@ class FillAnnotator:
|
||||||
raise DictConsistencyError(msg, 26)
|
raise DictConsistencyError(msg, 26)
|
||||||
|
|
||||||
# get the target variable
|
# get the target variable
|
||||||
variable = self.objectspace.paths.get_variable(fill.target)
|
variable = self.objectspace.paths.get_variable_obj(fill.target)
|
||||||
|
|
||||||
# create an object value
|
# create an object value
|
||||||
value = self.objectspace.value(fill.xmlfiles)
|
value = self.objectspace.value(fill.xmlfiles)
|
||||||
|
@ -94,13 +97,9 @@ class FillAnnotator:
|
||||||
path, suffix = self.objectspace.paths.get_variable_path(param.text,
|
path, suffix = self.objectspace.paths.get_variable_path(param.text,
|
||||||
fill.namespace,
|
fill.namespace,
|
||||||
)
|
)
|
||||||
param.text = self.objectspace.paths.get_variable(path)
|
param.text = self.objectspace.paths.get_variable_obj(path)
|
||||||
if suffix:
|
if suffix:
|
||||||
param.suffix = suffix
|
param.suffix = suffix
|
||||||
family_path = self.objectspace.paths.get_variable_family_path(path)
|
|
||||||
param.family = self.objectspace.paths.get_family(family_path,
|
|
||||||
param.text.namespace,
|
|
||||||
)
|
|
||||||
except DictConsistencyError as err:
|
except DictConsistencyError as err:
|
||||||
if err.errno != 42 or not param.optional:
|
if err.errno != 42 or not param.optional:
|
||||||
raise err
|
raise err
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
"""Annotate group
|
"""Annotate group
|
||||||
"""
|
"""
|
||||||
|
from typing import List
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
|
from ..config import Config
|
||||||
from ..error import DictConsistencyError
|
from ..error import DictConsistencyError
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,45 +22,59 @@ class GroupAnnotator:
|
||||||
def convert_groups(self): # pylint: disable=C0111
|
def convert_groups(self): # pylint: disable=C0111
|
||||||
"""convert groups
|
"""convert groups
|
||||||
"""
|
"""
|
||||||
# store old leaders family name
|
|
||||||
cache_paths = {}
|
cache_paths = {}
|
||||||
for group in self.objectspace.space.constraints.group:
|
for group in self.objectspace.space.constraints.group:
|
||||||
if group.leader in cache_paths:
|
leader_fullname = group.leader
|
||||||
leader_fam_path = cache_paths[group.leader]
|
leader = self.objectspace.paths.get_variable_obj(leader_fullname)
|
||||||
|
if leader_fullname in cache_paths:
|
||||||
|
leader_family_path = cache_paths[leader_fullname]
|
||||||
else:
|
else:
|
||||||
leader_fam_path = self.objectspace.paths.get_variable_family_path(group.leader)
|
leader_family_path = self.objectspace.paths.get_variable_family_path(leader_fullname)
|
||||||
cache_paths[group.leader] = leader_fam_path
|
cache_paths[leader_fullname] = leader_family_path
|
||||||
|
if '.' not in leader_fullname:
|
||||||
|
leader_fullname = '.'.join([leader_family_path, leader_fullname])
|
||||||
follower_names = list(group.follower.keys())
|
follower_names = list(group.follower.keys())
|
||||||
leader = self.objectspace.paths.get_variable(group.leader)
|
ori_leader_family = self.objectspace.paths.get_family(leader_family_path,
|
||||||
ori_leader_family = self.objectspace.paths.get_family(leader_fam_path,
|
|
||||||
leader.namespace,
|
leader.namespace,
|
||||||
)
|
)
|
||||||
has_a_leader = False
|
has_a_leader = False
|
||||||
for variable in list(ori_leader_family.variable.values()):
|
for variable in list(ori_leader_family.variable.values()):
|
||||||
if isinstance(variable, self.objectspace.leadership) and \
|
if has_a_leader:
|
||||||
variable.variable[0].name == leader.name:
|
# it's a follower
|
||||||
# append follower to an existed leadership
|
self.manage_follower(leader_family_path,
|
||||||
leader_space = variable
|
|
||||||
has_a_leader = True
|
|
||||||
elif variable.name == leader.name:
|
|
||||||
# it's a leader
|
|
||||||
leader_space = self.manage_leader(variable,
|
|
||||||
group,
|
|
||||||
ori_leader_family,
|
|
||||||
)
|
|
||||||
has_a_leader = True
|
|
||||||
elif has_a_leader:
|
|
||||||
# it's should be a follower
|
|
||||||
self.manage_follower(follower_names.pop(0),
|
|
||||||
leader_fam_path,
|
|
||||||
variable,
|
variable,
|
||||||
leader_space,
|
leadership_name,
|
||||||
|
follower_names,
|
||||||
)
|
)
|
||||||
# this variable is not more in ori_leader_family
|
if leader_is_hidden:
|
||||||
|
variable.frozen = True
|
||||||
|
variable.force_default_on_freeze = True
|
||||||
|
leader_space.variable.append(variable)
|
||||||
ori_leader_family.variable.pop(variable.name)
|
ori_leader_family.variable.pop(variable.name)
|
||||||
if follower_names == []:
|
if follower_names == []:
|
||||||
# no more follower
|
# no more follower
|
||||||
break
|
break
|
||||||
|
elif variable.name == leader.name:
|
||||||
|
# it's a leader
|
||||||
|
if isinstance(variable, self.objectspace.leadership):
|
||||||
|
# append follower to an existed leadership
|
||||||
|
leader_space = variable
|
||||||
|
# if variable.hidden:
|
||||||
|
# leader_is_hidden = True
|
||||||
|
else:
|
||||||
|
leader_space = self.objectspace.leadership(variable.xmlfiles)
|
||||||
|
if hasattr(group, 'name'):
|
||||||
|
leadership_name = group.name
|
||||||
|
else:
|
||||||
|
leadership_name = leader.name
|
||||||
|
leader_is_hidden = self.manage_leader(leader_space,
|
||||||
|
leader_family_path,
|
||||||
|
leadership_name,
|
||||||
|
leader.name,
|
||||||
|
variable,
|
||||||
|
group,
|
||||||
|
)
|
||||||
|
has_a_leader = True
|
||||||
else:
|
else:
|
||||||
xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles)
|
xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles)
|
||||||
joined = '", "'.join(follower_names)
|
joined = '", "'.join(follower_names)
|
||||||
|
@ -67,27 +84,28 @@ class GroupAnnotator:
|
||||||
del self.objectspace.space.constraints.group
|
del self.objectspace.space.constraints.group
|
||||||
|
|
||||||
def manage_leader(self,
|
def manage_leader(self,
|
||||||
|
leader_space: 'Leadership',
|
||||||
|
leader_family_name: str,
|
||||||
|
leadership_name: str,
|
||||||
|
leader_name: str,
|
||||||
variable: 'Variable',
|
variable: 'Variable',
|
||||||
group: 'Group',
|
group: 'Group',
|
||||||
ori_leader_family,
|
) -> None:
|
||||||
) -> 'Leadership':
|
|
||||||
"""manage leader's variable
|
"""manage leader's variable
|
||||||
"""
|
"""
|
||||||
if variable.multi is not True:
|
if variable.multi is not True:
|
||||||
xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles)
|
xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles)
|
||||||
msg = _(f'the variable "{variable.name}" in a group must be multi in {xmlfiles}')
|
msg = _(f'the variable "{variable.name}" in a group must be multi in {xmlfiles}')
|
||||||
raise DictConsistencyError(msg, 32)
|
raise DictConsistencyError(msg, 32)
|
||||||
if hasattr(group, 'name'):
|
|
||||||
leadership_name = group.name
|
|
||||||
else:
|
|
||||||
leadership_name = variable.name
|
|
||||||
leader_space = self.objectspace.leadership(variable.xmlfiles)
|
|
||||||
leader_space.variable = []
|
leader_space.variable = []
|
||||||
leader_space.name = leadership_name
|
leader_space.name = leadership_name
|
||||||
leader_space.hidden = variable.hidden
|
leader_space.hidden = variable.hidden
|
||||||
if variable.hidden:
|
if variable.hidden:
|
||||||
|
leader_is_hidden = True
|
||||||
variable.frozen = True
|
variable.frozen = True
|
||||||
variable.force_default_on_freeze = True
|
variable.force_default_on_freeze = True
|
||||||
|
else:
|
||||||
|
leader_is_hidden = False
|
||||||
variable.hidden = None
|
variable.hidden = None
|
||||||
if hasattr(group, 'description'):
|
if hasattr(group, 'description'):
|
||||||
leader_space.doc = group.description
|
leader_space.doc = group.description
|
||||||
|
@ -95,42 +113,38 @@ class GroupAnnotator:
|
||||||
leader_space.doc = variable.description
|
leader_space.doc = variable.description
|
||||||
else:
|
else:
|
||||||
leader_space.doc = leadership_name
|
leader_space.doc = leadership_name
|
||||||
leadership_path = ori_leader_family.path + '.' + leadership_name
|
namespace = variable.namespace
|
||||||
self.objectspace.paths.add_leadership(variable.namespace,
|
leadership_path = leader_family_name + '.' + leadership_name
|
||||||
|
self.objectspace.paths.add_leadership(namespace,
|
||||||
leadership_path,
|
leadership_path,
|
||||||
leader_space,
|
leader_space,
|
||||||
)
|
)
|
||||||
leader_family = self.objectspace.paths.get_family(ori_leader_family.path,
|
leader_family = self.objectspace.space.variables[namespace].family[leader_family_name.rsplit('.', 1)[-1]]
|
||||||
ori_leader_family.namespace,
|
leader_family.variable[leader_name] = leader_space
|
||||||
)
|
|
||||||
leader_family.variable[variable.name] = leader_space
|
|
||||||
leader_space.variable.append(variable)
|
leader_space.variable.append(variable)
|
||||||
self.objectspace.paths.set_leader(variable.namespace,
|
self.objectspace.paths.set_leader(namespace,
|
||||||
ori_leader_family.path,
|
leader_family_name,
|
||||||
leadership_name,
|
leadership_name,
|
||||||
variable.name,
|
leader_name,
|
||||||
)
|
)
|
||||||
return leader_space
|
return leader_is_hidden
|
||||||
|
|
||||||
def manage_follower(self,
|
def manage_follower(self,
|
||||||
follower_name: str,
|
|
||||||
leader_family_name: str,
|
leader_family_name: str,
|
||||||
variable: 'Variable',
|
variable: 'Variable',
|
||||||
leader_space: 'Leadership',
|
leadership_name: str,
|
||||||
|
follower_names: List[str],
|
||||||
) -> None:
|
) -> None:
|
||||||
"""manage follower
|
"""manage follower
|
||||||
"""
|
"""
|
||||||
|
follower_name = follower_names.pop(0)
|
||||||
if variable.name != follower_name:
|
if variable.name != follower_name:
|
||||||
xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles)
|
xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles)
|
||||||
msg = _('when parsing leadership, we expect to find the follower '
|
msg = _('when parsing leadership, we espect to find the follower '
|
||||||
f'"{follower_name}" but we found "{variable.name}" in {xmlfiles}')
|
f'"{follower_name}" but we found "{variable.name}" in {xmlfiles}')
|
||||||
raise DictConsistencyError(msg, 33)
|
raise DictConsistencyError(msg, 33)
|
||||||
self.objectspace.paths.set_leader(variable.namespace,
|
self.objectspace.paths.set_leader(variable.namespace,
|
||||||
leader_family_name,
|
leader_family_name,
|
||||||
leader_space.name,
|
leadership_name,
|
||||||
variable.name,
|
variable.name,
|
||||||
)
|
)
|
||||||
if leader_space.hidden:
|
|
||||||
variable.frozen = True
|
|
||||||
variable.force_default_on_freeze = True
|
|
||||||
leader_space.variable.append(variable)
|
|
||||||
|
|
|
@ -36,15 +36,13 @@ class PropertyAnnotator:
|
||||||
if hasattr(variable, 'mode') and variable.mode:
|
if hasattr(variable, 'mode') and variable.mode:
|
||||||
properties.append(variable.mode)
|
properties.append(variable.mode)
|
||||||
variable.mode = None
|
variable.mode = None
|
||||||
if 'force_store_value' in properties and \
|
if 'force_store_value' in properties and 'force_default_on_freeze' in properties:
|
||||||
'force_default_on_freeze' in properties: # pragma: no cover
|
|
||||||
# should not appened
|
|
||||||
xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles)
|
xmlfiles = self.objectspace.display_xmlfiles(variable.xmlfiles)
|
||||||
msg = _('cannot have auto_freeze or auto_store with the hidden '
|
msg = _('cannot have auto_freeze or auto_store with the hidden '
|
||||||
f'variable "{variable.name}" in {xmlfiles}')
|
f'variable "{variable.name}" in {xmlfiles}')
|
||||||
raise DictConsistencyError(msg, 50)
|
raise DictConsistencyError(msg, 50)
|
||||||
if properties:
|
if properties:
|
||||||
variable.properties = set(properties)
|
variable.properties = frozenset(properties)
|
||||||
|
|
||||||
def convert_services(self) -> None:
|
def convert_services(self) -> None:
|
||||||
"""convert services
|
"""convert services
|
||||||
|
|
|
@ -10,8 +10,7 @@ from ..error import DictConsistencyError
|
||||||
# that shall not be present in the exported (flatened) XML
|
# that shall not be present in the exported (flatened) XML
|
||||||
ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check', 'namespace',
|
ERASED_ATTRIBUTES = ('redefine', 'exists', 'fallback', 'optional', 'remove_check', 'namespace',
|
||||||
'remove_condition', 'path', 'instance_mode', 'index', 'is_in_leadership',
|
'remove_condition', 'path', 'instance_mode', 'index', 'is_in_leadership',
|
||||||
'level', 'remove_fill', 'xmlfiles', 'type', 'reflector_name',
|
'level', 'remove_fill', 'xmlfiles', 'type')
|
||||||
'reflector_object',)
|
|
||||||
|
|
||||||
|
|
||||||
KEY_TYPE = {'variable': 'symlink',
|
KEY_TYPE = {'variable': 'symlink',
|
||||||
|
@ -49,18 +48,16 @@ class ServiceAnnotator:
|
||||||
self.objectspace.space.services.hidden = True
|
self.objectspace.space.services.hidden = True
|
||||||
self.objectspace.space.services.name = 'services'
|
self.objectspace.space.services.name = 'services'
|
||||||
self.objectspace.space.services.doc = 'services'
|
self.objectspace.space.services.doc = 'services'
|
||||||
self.objectspace.space.services.path = 'services'
|
|
||||||
families = {}
|
families = {}
|
||||||
for service_name in self.objectspace.space.services.service.keys():
|
for service_name in self.objectspace.space.services.service.keys():
|
||||||
service = self.objectspace.space.services.service[service_name]
|
service = self.objectspace.space.services.service[service_name]
|
||||||
new_service = self.objectspace.service(service.xmlfiles)
|
new_service = self.objectspace.service(service.xmlfiles)
|
||||||
new_service.path = f'services.{service_name}'
|
|
||||||
for elttype, values in vars(service).items():
|
for elttype, values in vars(service).items():
|
||||||
if not isinstance(values, (dict, list)) or elttype in ERASED_ATTRIBUTES:
|
if not isinstance(values, (dict, list)) or elttype in ERASED_ATTRIBUTES:
|
||||||
setattr(new_service, elttype, values)
|
setattr(new_service, elttype, values)
|
||||||
continue
|
continue
|
||||||
eltname = elttype + 's'
|
eltname = elttype + 's'
|
||||||
path = '.'.join(['services', normalize_family(service_name), eltname])
|
path = '.'.join(['services', service_name, eltname])
|
||||||
family = self._gen_family(eltname,
|
family = self._gen_family(eltname,
|
||||||
path,
|
path,
|
||||||
service.xmlfiles,
|
service.xmlfiles,
|
||||||
|
@ -148,7 +145,7 @@ class ServiceAnnotator:
|
||||||
c_name = name
|
c_name = name
|
||||||
if idx:
|
if idx:
|
||||||
c_name += f'_{idx}'
|
c_name += f'_{idx}'
|
||||||
subpath = '{}.{}'.format(path, normalize_family(c_name))
|
subpath = '{}.{}'.format(path, c_name)
|
||||||
try:
|
try:
|
||||||
self.objectspace.paths.get_family(subpath, 'services')
|
self.objectspace.paths.get_family(subpath, 'services')
|
||||||
except DictConsistencyError as err:
|
except DictConsistencyError as err:
|
||||||
|
@ -183,7 +180,7 @@ class ServiceAnnotator:
|
||||||
variable.mode = None
|
variable.mode = None
|
||||||
variable.type = type_
|
variable.type = type_
|
||||||
if type_ == 'symlink':
|
if type_ == 'symlink':
|
||||||
variable.opt = self.objectspace.paths.get_variable(value)
|
variable.opt = self.objectspace.paths.get_variable_obj(value)
|
||||||
variable.multi = None
|
variable.multi = None
|
||||||
else:
|
else:
|
||||||
variable.doc = key
|
variable.doc = key
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
"""Annotate variable
|
"""Annotate variable
|
||||||
"""
|
"""
|
||||||
|
from ..i18n import _
|
||||||
from ..utils import normalize_family
|
from ..utils import normalize_family
|
||||||
from ..config import Config
|
from ..error import DictConsistencyError
|
||||||
|
|
||||||
|
|
||||||
CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
|
CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
|
||||||
|
@ -50,10 +51,10 @@ class VariableAnnotator:
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
objectspace,
|
objectspace,
|
||||||
):
|
):
|
||||||
if not hasattr(objectspace.space, 'variables'):
|
|
||||||
return
|
|
||||||
self.objectspace = objectspace
|
self.objectspace = objectspace
|
||||||
self.convert_variable()
|
if hasattr(self.objectspace.space, 'variables'):
|
||||||
|
self.convert_variable()
|
||||||
|
self.convert_separators()
|
||||||
|
|
||||||
def _convert_variable(self,
|
def _convert_variable(self,
|
||||||
namespace: str,
|
namespace: str,
|
||||||
|
@ -119,7 +120,6 @@ class VariableAnnotator:
|
||||||
"""
|
"""
|
||||||
for families in self.objectspace.space.variables.values():
|
for families in self.objectspace.space.variables.values():
|
||||||
families.doc = families.name
|
families.doc = families.name
|
||||||
families.path = families.name
|
|
||||||
for family in families.family.values():
|
for family in families.family.values():
|
||||||
family.doc = family.name
|
family.doc = family.name
|
||||||
family.name = normalize_family(family.name)
|
family.name = normalize_family(family.name)
|
||||||
|
@ -140,3 +140,17 @@ class VariableAnnotator:
|
||||||
variable,
|
variable,
|
||||||
'variable',
|
'variable',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def convert_separators(self): # pylint: disable=C0111,R0201
|
||||||
|
for family in self.objectspace.space.variables.values():
|
||||||
|
if not hasattr(family, 'separators'):
|
||||||
|
continue
|
||||||
|
if hasattr(family.separators, 'separator'):
|
||||||
|
for separator in family.separators.separator:
|
||||||
|
option = self.objectspace.paths.get_variable_obj(separator.name)
|
||||||
|
if hasattr(option, 'separator'):
|
||||||
|
xmlfiles = self.objectspace.display_xmlfiles(separator.xmlfiles)
|
||||||
|
msg = _(f'{separator.name} already has a separator in {xmlfiles}')
|
||||||
|
raise DictConsistencyError(msg, 35)
|
||||||
|
option.separator = separator.text
|
||||||
|
del family.separators
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
<!ATTLIST override source CDATA #IMPLIED >
|
<!ATTLIST override source CDATA #IMPLIED >
|
||||||
<!ATTLIST override templating (True|False) "True">
|
<!ATTLIST override templating (True|False) "True">
|
||||||
|
|
||||||
<!ELEMENT variables (family*)>
|
<!ELEMENT variables (family*, separators*)>
|
||||||
<!ELEMENT family (variable*)>
|
<!ELEMENT family (variable*)>
|
||||||
<!ATTLIST family name CDATA #REQUIRED>
|
<!ATTLIST family name CDATA #REQUIRED>
|
||||||
<!ATTLIST family description CDATA #IMPLIED>
|
<!ATTLIST family description CDATA #IMPLIED>
|
||||||
|
@ -107,6 +107,11 @@
|
||||||
<!ATTLIST variable remove_fill (True|False) "False">
|
<!ATTLIST variable remove_fill (True|False) "False">
|
||||||
<!ATTLIST variable test CDATA #IMPLIED>
|
<!ATTLIST variable test CDATA #IMPLIED>
|
||||||
|
|
||||||
|
<!ELEMENT separators (separator*)>
|
||||||
|
|
||||||
|
<!ELEMENT separator (#PCDATA)>
|
||||||
|
<!ATTLIST separator name CDATA #REQUIRED>
|
||||||
|
|
||||||
<!ELEMENT value (#PCDATA)>
|
<!ELEMENT value (#PCDATA)>
|
||||||
|
|
||||||
<!ELEMENT constraints ((fill* | check* | condition* | group*)*)>
|
<!ELEMENT constraints ((fill* | check* | condition* | group*)*)>
|
||||||
|
|
|
@ -1,18 +1,14 @@
|
||||||
"""Standard error classes
|
# -*- coding: utf-8 -*-
|
||||||
"""
|
|
||||||
class ConfigError(Exception):
|
class ConfigError(Exception):
|
||||||
"""Standard error for templating
|
pass
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class FileNotFound(ConfigError):
|
class FileNotFound(ConfigError):
|
||||||
"""Template file is not found
|
pass
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class TemplateError(ConfigError):
|
class TemplateError(ConfigError):
|
||||||
"""Templating generate an error
|
pass
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
class TemplateDisabled(TemplateError):
|
class TemplateDisabled(TemplateError):
|
||||||
|
@ -33,3 +29,7 @@ class DictConsistencyError(Exception):
|
||||||
def __init__(self, msg, errno):
|
def __init__(self, msg, errno):
|
||||||
super().__init__(msg)
|
super().__init__(msg)
|
||||||
self.errno = errno
|
self.errno = errno
|
||||||
|
|
||||||
|
|
||||||
|
class LoaderError(Exception):
|
||||||
|
pass
|
||||||
|
|
|
@ -306,7 +306,7 @@ class RougailObjSpace:
|
||||||
) -> None:
|
) -> None:
|
||||||
"""if an object exists, return it
|
"""if an object exists, return it
|
||||||
"""
|
"""
|
||||||
if child.tag in ['variable', 'family']:
|
if child.tag == 'family':
|
||||||
name = normalize_family(name)
|
name = normalize_family(name)
|
||||||
if isinstance(space, self.family): # pylint: disable=E1101
|
if isinstance(space, self.family): # pylint: disable=E1101
|
||||||
if namespace != Config['variable_namespace']:
|
if namespace != Config['variable_namespace']:
|
||||||
|
@ -319,8 +319,7 @@ class RougailObjSpace:
|
||||||
msg = _(f'Variable was previously create in family "{old_family_name}", '
|
msg = _(f'Variable was previously create in family "{old_family_name}", '
|
||||||
f'now it is in "{space.path}" in {xmlfiles}')
|
f'now it is in "{space.path}" in {xmlfiles}')
|
||||||
raise DictConsistencyError(msg, 47)
|
raise DictConsistencyError(msg, 47)
|
||||||
return self.paths.get_variable(name)
|
return self.paths.get_variable_obj(name)
|
||||||
# it's not a family
|
|
||||||
children = getattr(space, child.tag, {})
|
children = getattr(space, child.tag, {})
|
||||||
if name in children:
|
if name in children:
|
||||||
return children[name]
|
return children[name]
|
||||||
|
@ -438,7 +437,7 @@ class RougailObjSpace:
|
||||||
if isinstance(variableobj, self.variable): # pylint: disable=E1101
|
if isinstance(variableobj, self.variable): # pylint: disable=E1101
|
||||||
family_name = normalize_family(document.attrib['name'])
|
family_name = normalize_family(document.attrib['name'])
|
||||||
self.paths.add_variable(namespace,
|
self.paths.add_variable(namespace,
|
||||||
normalize_family(variableobj.name),
|
variableobj.name,
|
||||||
namespace + '.' + family_name,
|
namespace + '.' + family_name,
|
||||||
document.attrib.get('dynamic') is not None,
|
document.attrib.get('dynamic') is not None,
|
||||||
variableobj,
|
variableobj,
|
||||||
|
@ -463,7 +462,7 @@ class RougailObjSpace:
|
||||||
variableobj.namespace = namespace
|
variableobj.namespace = namespace
|
||||||
if isinstance(variableobj, Redefinable):
|
if isinstance(variableobj, Redefinable):
|
||||||
name = variableobj.name
|
name = variableobj.name
|
||||||
if child.tag in ['family', 'variable']:
|
if child.tag == 'family':
|
||||||
name = normalize_family(name)
|
name = normalize_family(name)
|
||||||
getattr(space, child.tag)[name] = variableobj
|
getattr(space, child.tag)[name] = variableobj
|
||||||
elif isinstance(variableobj, UnRedefinable):
|
elif isinstance(variableobj, UnRedefinable):
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
"""Manage path to find objects
|
|
||||||
"""
|
|
||||||
from .i18n import _
|
from .i18n import _
|
||||||
from .error import DictConsistencyError
|
from .error import DictConsistencyError
|
||||||
from .config import Config
|
from .config import Config
|
||||||
|
@ -24,15 +22,12 @@ class Path:
|
||||||
name: str,
|
name: str,
|
||||||
variableobj: str,
|
variableobj: str,
|
||||||
) -> str: # pylint: disable=C0111
|
) -> str: # pylint: disable=C0111
|
||||||
"""Add a new family
|
|
||||||
"""
|
|
||||||
if namespace == Config['variable_namespace']:
|
if namespace == Config['variable_namespace']:
|
||||||
full_name = '.'.join([namespace, name])
|
full_name = '.'.join([namespace, name])
|
||||||
self.full_paths_families[name] = full_name
|
self.full_paths_families[name] = full_name
|
||||||
else:
|
else:
|
||||||
if '.' not in name: # pragma: no cover
|
if '.' not in name:
|
||||||
msg = _(f'Variable "{name}" in namespace "{namespace}" must have dot')
|
raise DictConsistencyError(_(f'Variable "{name}" in namespace "{namespace}" must have dot'), 39)
|
||||||
raise DictConsistencyError(msg, 39)
|
|
||||||
full_name = name
|
full_name = name
|
||||||
if full_name in self.families and \
|
if full_name in self.families and \
|
||||||
self.families[full_name]['variableobj'] != variableobj: # pragma: no cover
|
self.families[full_name]['variableobj'] != variableobj: # pragma: no cover
|
||||||
|
@ -48,8 +43,6 @@ class Path:
|
||||||
path: str,
|
path: str,
|
||||||
variableobj: str,
|
variableobj: str,
|
||||||
) -> str: # pylint: disable=C0111
|
) -> str: # pylint: disable=C0111
|
||||||
"""add a new leadership
|
|
||||||
"""
|
|
||||||
self.families[path] = dict(name=path,
|
self.families[path] = dict(name=path,
|
||||||
namespace=namespace,
|
namespace=namespace,
|
||||||
variableobj=variableobj,
|
variableobj=variableobj,
|
||||||
|
@ -60,19 +53,14 @@ class Path:
|
||||||
name: str,
|
name: str,
|
||||||
current_namespace: str,
|
current_namespace: str,
|
||||||
) -> 'Family': # pylint: disable=C0111
|
) -> 'Family': # pylint: disable=C0111
|
||||||
"""Get a family
|
|
||||||
"""
|
|
||||||
name = '.'.join([normalize_family(subname) for subname in name.split('.')])
|
name = '.'.join([normalize_family(subname) for subname in name.split('.')])
|
||||||
if name not in self.families and name in self.full_paths_families:
|
if name not in self.families and name in self.full_paths_families:
|
||||||
name = self.full_paths_families[name]
|
name = self.full_paths_families[name]
|
||||||
if name not in self.families:
|
if name not in self.families:
|
||||||
raise DictConsistencyError(_('unknown option {}').format(name), 42)
|
raise DictConsistencyError(_('unknown option {}').format(name), 42)
|
||||||
dico = self.families[name]
|
dico = self.families[name]
|
||||||
if current_namespace not in [Config['variable_namespace'], 'services'] and \
|
if current_namespace not in [Config['variable_namespace'], 'services'] and current_namespace != dico['namespace']:
|
||||||
current_namespace != dico['namespace']:
|
raise DictConsistencyError(_(f'A family located in the "{dico["namespace"]}" namespace shall not be used in the "{current_namespace}" namespace'), 38)
|
||||||
msg = _(f'A family located in the "{dico["namespace"]}" namespace '
|
|
||||||
f'shall not be used in the "{current_namespace}" namespace')
|
|
||||||
raise DictConsistencyError(msg, 38)
|
|
||||||
return dico['variableobj']
|
return dico['variableobj']
|
||||||
|
|
||||||
# Leadership
|
# Leadership
|
||||||
|
@ -82,8 +70,6 @@ class Path:
|
||||||
leadership_name: str,
|
leadership_name: str,
|
||||||
name: str,
|
name: str,
|
||||||
) -> None: # pylint: disable=C0111
|
) -> None: # pylint: disable=C0111
|
||||||
"""set a variable a leadership member
|
|
||||||
"""
|
|
||||||
# need rebuild path and move object in new path
|
# need rebuild path and move object in new path
|
||||||
old_path = leader_family_name + '.' + name
|
old_path = leader_family_name + '.' + name
|
||||||
leadership_path = leader_family_name + '.' + leadership_name
|
leadership_path = leader_family_name + '.' + leadership_name
|
||||||
|
@ -96,13 +82,9 @@ class Path:
|
||||||
self.full_paths_variables[name] = new_path
|
self.full_paths_variables[name] = new_path
|
||||||
|
|
||||||
def is_in_leadership(self, name):
|
def is_in_leadership(self, name):
|
||||||
"""Is the variable is in a leadership
|
|
||||||
"""
|
|
||||||
return self._get_variable(name)['leader'] is not None
|
return self._get_variable(name)['leader'] is not None
|
||||||
|
|
||||||
def is_leader(self, path): # pylint: disable=C0111
|
def is_leader(self, path): # pylint: disable=C0111
|
||||||
"""Is the variable is a leader
|
|
||||||
"""
|
|
||||||
variable = self._get_variable(path)
|
variable = self._get_variable(path)
|
||||||
if not variable['leader']:
|
if not variable['leader']:
|
||||||
return False
|
return False
|
||||||
|
@ -117,8 +99,6 @@ class Path:
|
||||||
is_dynamic: bool,
|
is_dynamic: bool,
|
||||||
variableobj,
|
variableobj,
|
||||||
) -> str: # pylint: disable=C0111
|
) -> str: # pylint: disable=C0111
|
||||||
"""Add a new variable (with path)
|
|
||||||
"""
|
|
||||||
if '.' not in name:
|
if '.' not in name:
|
||||||
full_path = '.'.join([family, name])
|
full_path = '.'.join([family, name])
|
||||||
if namespace == Config['variable_namespace']:
|
if namespace == Config['variable_namespace']:
|
||||||
|
@ -133,11 +113,9 @@ class Path:
|
||||||
variableobj=variableobj,
|
variableobj=variableobj,
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_variable(self,
|
def get_variable_obj(self,
|
||||||
name: str,
|
name: str,
|
||||||
) -> 'Variable': # pylint: disable=C0111
|
) -> 'Variable': # pylint: disable=C0111
|
||||||
"""Get variable object from a path
|
|
||||||
"""
|
|
||||||
variable, suffix = self._get_variable(name, with_suffix=True)
|
variable, suffix = self._get_variable(name, with_suffix=True)
|
||||||
if suffix:
|
if suffix:
|
||||||
raise DictConsistencyError(_(f"{name} is a dynamic variable"), 36)
|
raise DictConsistencyError(_(f"{name} is a dynamic variable"), 36)
|
||||||
|
@ -146,41 +124,30 @@ class Path:
|
||||||
def get_variable_family_path(self,
|
def get_variable_family_path(self,
|
||||||
name: str,
|
name: str,
|
||||||
) -> str: # pylint: disable=C0111
|
) -> str: # pylint: disable=C0111
|
||||||
"""Get the full path of a family
|
|
||||||
"""
|
|
||||||
return self._get_variable(name)['family']
|
return self._get_variable(name)['family']
|
||||||
|
|
||||||
def get_variable_path(self,
|
def get_variable_path(self,
|
||||||
name: str,
|
name: str,
|
||||||
current_namespace: str,
|
current_namespace: str,
|
||||||
) -> str: # pylint: disable=C0111
|
) -> str: # pylint: disable=C0111
|
||||||
"""get full path of a variable
|
|
||||||
"""
|
|
||||||
dico, suffix = self._get_variable(name,
|
dico, suffix = self._get_variable(name,
|
||||||
with_suffix=True,
|
with_suffix=True,
|
||||||
)
|
)
|
||||||
namespace = dico['variableobj'].namespace
|
namespace = dico['variableobj'].namespace
|
||||||
if namespace not in [Config['variable_namespace'], 'services'] and \
|
if namespace not in [Config['variable_namespace'], 'services'] and current_namespace != namespace:
|
||||||
current_namespace != namespace:
|
raise DictConsistencyError(_(f'A variable located in the "{namespace}" namespace shall not be used in the "{current_namespace}" namespace'), 41)
|
||||||
msg = _(f'A variable located in the "{namespace}" namespace shall not be used '
|
|
||||||
f'in the "{current_namespace}" namespace')
|
|
||||||
raise DictConsistencyError(msg, 41)
|
|
||||||
return dico['variableobj'].path, suffix
|
return dico['variableobj'].path, suffix
|
||||||
|
|
||||||
def path_is_defined(self,
|
def path_is_defined(self,
|
||||||
path: str,
|
name: str,
|
||||||
) -> str: # pylint: disable=C0111
|
) -> str: # pylint: disable=C0111
|
||||||
"""The path is a valid path
|
if '.' not in name and name not in self.variables and name in self.full_paths_variables:
|
||||||
"""
|
|
||||||
if '.' not in path and path not in self.variables and path in self.full_paths_variables:
|
|
||||||
return True
|
return True
|
||||||
return path in self.variables
|
return name in self.variables
|
||||||
|
|
||||||
def variable_is_dynamic(self,
|
def variable_is_dynamic(self,
|
||||||
name: str,
|
name: str,
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""This variable is in dynamic family
|
|
||||||
"""
|
|
||||||
return self._get_variable(name)['is_dynamic']
|
return self._get_variable(name)['is_dynamic']
|
||||||
|
|
||||||
def _get_variable(self,
|
def _get_variable(self,
|
||||||
|
|
|
@ -28,15 +28,12 @@ from .annotator import SpaceAnnotator
|
||||||
|
|
||||||
|
|
||||||
class Rougail:
|
class Rougail:
|
||||||
"""Rougail object
|
|
||||||
"""
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
dtdfilename: str,
|
dtdfilename: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.xmlreflector = XMLReflector()
|
self.xmlreflector = XMLReflector()
|
||||||
self.xmlreflector.parse_dtd(dtdfilename)
|
self.xmlreflector.parse_dtd(dtdfilename)
|
||||||
self.rougailobjspace = RougailObjSpace(self.xmlreflector)
|
self.rougailobjspace = RougailObjSpace(self.xmlreflector)
|
||||||
self.funcs_path = None
|
|
||||||
|
|
||||||
def create_or_populate_from_xml(self,
|
def create_or_populate_from_xml(self,
|
||||||
namespace: str,
|
namespace: str,
|
||||||
|
@ -56,14 +53,10 @@ class Rougail:
|
||||||
def space_visitor(self,
|
def space_visitor(self,
|
||||||
eosfunc_file: str,
|
eosfunc_file: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""All XML are loader, now annotate content
|
|
||||||
"""
|
|
||||||
self.funcs_path = eosfunc_file
|
self.funcs_path = eosfunc_file
|
||||||
SpaceAnnotator(self.rougailobjspace, eosfunc_file)
|
SpaceAnnotator(self.rougailobjspace, eosfunc_file)
|
||||||
|
|
||||||
def save(self) -> str:
|
def save(self) -> str:
|
||||||
"""Return tiramisu object declaration as a string
|
|
||||||
"""
|
|
||||||
tiramisu_objects = TiramisuReflector(self.rougailobjspace.space,
|
tiramisu_objects = TiramisuReflector(self.rougailobjspace.space,
|
||||||
self.funcs_path,
|
self.funcs_path,
|
||||||
)
|
)
|
||||||
|
|
|
@ -4,6 +4,7 @@ Gestion du mini-langage de template
|
||||||
On travaille sur les fichiers cibles
|
On travaille sur les fichiers cibles
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from importlib.machinery import SourceFileLoader
|
||||||
from shutil import copy
|
from shutil import copy
|
||||||
import logging
|
import logging
|
||||||
from typing import Dict, Any
|
from typing import Dict, Any
|
||||||
|
@ -24,7 +25,7 @@ except ModuleNotFoundError: # pragma: no cover
|
||||||
from .config import Config
|
from .config import Config
|
||||||
from .error import FileNotFound, TemplateError
|
from .error import FileNotFound, TemplateError
|
||||||
from .i18n import _
|
from .i18n import _
|
||||||
from .utils import normalize_family, load_modules
|
from .utils import normalize_family
|
||||||
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
@ -33,8 +34,6 @@ log.addHandler(logging.NullHandler())
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def cl_compile(kls, *args, **kwargs):
|
def cl_compile(kls, *args, **kwargs):
|
||||||
"""Rewrite compile methode to force some settings
|
|
||||||
"""
|
|
||||||
kwargs['compilerSettings'] = {'directiveStartToken' : '%',
|
kwargs['compilerSettings'] = {'directiveStartToken' : '%',
|
||||||
'cheetahVarStartToken' : '%%',
|
'cheetahVarStartToken' : '%%',
|
||||||
'EOLSlurpToken' : '%',
|
'EOLSlurpToken' : '%',
|
||||||
|
@ -50,16 +49,23 @@ ChtTemplate.compile = cl_compile
|
||||||
|
|
||||||
|
|
||||||
class CheetahTemplate(ChtTemplate):
|
class CheetahTemplate(ChtTemplate):
|
||||||
"""Construct a cheetah templating object
|
"""classe pour personnaliser et faciliter la construction
|
||||||
|
du template Cheetah
|
||||||
"""
|
"""
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
filename: str,
|
filename: str,
|
||||||
context,
|
context,
|
||||||
eosfunc: Dict,
|
eosfunc: Dict,
|
||||||
extra_context: Dict,
|
destfilename,
|
||||||
|
variable,
|
||||||
):
|
):
|
||||||
"""Initialize Creole CheetahTemplate
|
"""Initialize Creole CheetahTemplate
|
||||||
"""
|
"""
|
||||||
|
extra_context = {'normalize_family': normalize_family,
|
||||||
|
'rougail_filename': destfilename
|
||||||
|
}
|
||||||
|
if variable:
|
||||||
|
extra_context['rougail_variable'] = variable
|
||||||
ChtTemplate.__init__(self,
|
ChtTemplate.__init__(self,
|
||||||
file=filename,
|
file=filename,
|
||||||
searchList=[context, eosfunc, extra_context])
|
searchList=[context, eosfunc, extra_context])
|
||||||
|
@ -69,12 +75,12 @@ class CheetahTemplate(ChtTemplate):
|
||||||
path=None,
|
path=None,
|
||||||
normpath=normpath,
|
normpath=normpath,
|
||||||
abspath=abspath
|
abspath=abspath
|
||||||
): # pylint: disable=W0621
|
):
|
||||||
|
|
||||||
# strange...
|
# strange...
|
||||||
if path is None and isinstance(self, str):
|
if path is None and isinstance(self, str):
|
||||||
path = self
|
path = self
|
||||||
if path: # pylint: disable=R1705
|
if path:
|
||||||
return normpath(abspath(path))
|
return normpath(abspath(path))
|
||||||
# original code return normpath(abspath(path.replace("\\", '/')))
|
# original code return normpath(abspath(path.replace("\\", '/')))
|
||||||
elif hasattr(self, '_filePath') and self._filePath: # pragma: no cover
|
elif hasattr(self, '_filePath') and self._filePath: # pragma: no cover
|
||||||
|
@ -84,8 +90,6 @@ class CheetahTemplate(ChtTemplate):
|
||||||
|
|
||||||
|
|
||||||
class CreoleLeaderIndex:
|
class CreoleLeaderIndex:
|
||||||
"""This object is create when access to a specified Index of the variable
|
|
||||||
"""
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
value,
|
value,
|
||||||
follower,
|
follower,
|
||||||
|
@ -132,9 +136,6 @@ class CreoleLeaderIndex:
|
||||||
|
|
||||||
|
|
||||||
class CreoleLeader:
|
class CreoleLeader:
|
||||||
"""Implement access to leader and follower variable
|
|
||||||
For examples: %%leader, %%leader[0].follower1
|
|
||||||
"""
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
value,
|
value,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -169,8 +170,6 @@ class CreoleLeader:
|
||||||
name: str,
|
name: str,
|
||||||
path: str,
|
path: str,
|
||||||
):
|
):
|
||||||
"""Add a new follower
|
|
||||||
"""
|
|
||||||
self._follower[name] = []
|
self._follower[name] = []
|
||||||
for index in range(len(self._value)):
|
for index in range(len(self._value)):
|
||||||
try:
|
try:
|
||||||
|
@ -181,9 +180,6 @@ class CreoleLeader:
|
||||||
|
|
||||||
|
|
||||||
class CreoleExtra:
|
class CreoleExtra:
|
||||||
"""Object that implement access to extra variable
|
|
||||||
For example %%extra1.family.variable
|
|
||||||
"""
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
suboption: Dict) -> None:
|
suboption: Dict) -> None:
|
||||||
self.suboption = suboption
|
self.suboption = suboption
|
||||||
|
@ -213,13 +209,60 @@ class CreoleTemplateEngine:
|
||||||
self.distrib_dir = distrib_dir
|
self.distrib_dir = distrib_dir
|
||||||
eos = {}
|
eos = {}
|
||||||
if eosfunc_file is not None:
|
if eosfunc_file is not None:
|
||||||
eosfunc = load_modules(eosfunc_file)
|
eosfunc = SourceFileLoader('eosfunc', eosfunc_file).load_module()
|
||||||
for func in dir(eosfunc):
|
for func in dir(eosfunc):
|
||||||
if not func.startswith('_'):
|
if not func.startswith('_'):
|
||||||
eos[func] = getattr(eosfunc, func)
|
eos[func] = getattr(eosfunc, func)
|
||||||
self.eosfunc = eos
|
self.eosfunc = eos
|
||||||
self.rougail_variables_dict = {}
|
self.rougail_variables_dict = {}
|
||||||
|
|
||||||
|
async def load_eole_variables_rougail(self,
|
||||||
|
optiondescription,
|
||||||
|
):
|
||||||
|
for option in await optiondescription.list('all'):
|
||||||
|
if await option.option.isoptiondescription():
|
||||||
|
if await option.option.isleadership():
|
||||||
|
for idx, suboption in enumerate(await option.list('all')):
|
||||||
|
if idx == 0:
|
||||||
|
leader = CreoleLeader(await suboption.value.get())
|
||||||
|
self.rougail_variables_dict[await suboption.option.name()] = leader
|
||||||
|
else:
|
||||||
|
await leader.add_follower(self.config,
|
||||||
|
await suboption.option.name(),
|
||||||
|
await suboption.option.path(),
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
await self.load_eole_variables_rougail(option)
|
||||||
|
else:
|
||||||
|
self.rougail_variables_dict[await option.option.name()] = await option.value.get()
|
||||||
|
|
||||||
|
async def load_eole_variables(self,
|
||||||
|
optiondescription,
|
||||||
|
):
|
||||||
|
families = {}
|
||||||
|
for family in await optiondescription.list('all'):
|
||||||
|
variables = {}
|
||||||
|
for variable in await family.list('all'):
|
||||||
|
if await variable.option.isoptiondescription():
|
||||||
|
if await variable.option.isleadership():
|
||||||
|
for idx, suboption in enumerate(await variable.list('all')):
|
||||||
|
if idx == 0:
|
||||||
|
leader = CreoleLeader(await suboption.value.get())
|
||||||
|
leader_name = await suboption.option.name()
|
||||||
|
else:
|
||||||
|
await leader.add_follower(self.config,
|
||||||
|
await suboption.option.name(),
|
||||||
|
await suboption.option.path(),
|
||||||
|
)
|
||||||
|
variables[leader_name] = leader
|
||||||
|
else:
|
||||||
|
subfamilies = await self.load_eole_variables(variable)
|
||||||
|
variables[await variable.option.name()] = subfamilies
|
||||||
|
else:
|
||||||
|
variables[await variable.option.name()] = await variable.value.get()
|
||||||
|
families[await family.option.name()] = CreoleExtra(variables)
|
||||||
|
return CreoleExtra(families)
|
||||||
|
|
||||||
def patch_template(self,
|
def patch_template(self,
|
||||||
filename: str,
|
filename: str,
|
||||||
tmp_dir: str,
|
tmp_dir: str,
|
||||||
|
@ -237,9 +280,7 @@ class CreoleTemplateEngine:
|
||||||
ret = call(patch_cmd + patch_no_debug + ['-i', rel_patch_file])
|
ret = call(patch_cmd + patch_no_debug + ['-i', rel_patch_file])
|
||||||
if ret: # pragma: no cover
|
if ret: # pragma: no cover
|
||||||
patch_cmd_err = ' '.join(patch_cmd + ['-i', rel_patch_file])
|
patch_cmd_err = ' '.join(patch_cmd + ['-i', rel_patch_file])
|
||||||
msg = _(f"Error applying patch: '{rel_patch_file}'\n"
|
log.error(_(f"Error applying patch: '{rel_patch_file}'\nTo reproduce and fix this error {patch_cmd_err}"))
|
||||||
f"To reproduce and fix this error {patch_cmd_err}")
|
|
||||||
log.error(_(msg))
|
|
||||||
copy(join(self.distrib_dir, filename), tmp_dir)
|
copy(join(self.distrib_dir, filename), tmp_dir)
|
||||||
|
|
||||||
def prepare_template(self,
|
def prepare_template(self,
|
||||||
|
@ -264,24 +305,18 @@ class CreoleTemplateEngine:
|
||||||
# full path of the destination file
|
# full path of the destination file
|
||||||
log.info(_(f"Cheetah processing: '{destfilename}'"))
|
log.info(_(f"Cheetah processing: '{destfilename}'"))
|
||||||
try:
|
try:
|
||||||
extra_context = {'normalize_family': normalize_family,
|
|
||||||
'rougail_filename': true_destfilename
|
|
||||||
}
|
|
||||||
if variable:
|
|
||||||
extra_context['rougail_variable'] = variable
|
|
||||||
cheetah_template = CheetahTemplate(source,
|
cheetah_template = CheetahTemplate(source,
|
||||||
self.rougail_variables_dict,
|
self.rougail_variables_dict,
|
||||||
self.eosfunc,
|
self.eosfunc,
|
||||||
extra_context,
|
true_destfilename,
|
||||||
|
variable,
|
||||||
)
|
)
|
||||||
data = str(cheetah_template)
|
data = str(cheetah_template)
|
||||||
except CheetahNotFound as err: # pragma: no cover
|
except CheetahNotFound as err: # pragma: no cover
|
||||||
varname = err.args[0][13:-1]
|
varname = err.args[0][13:-1]
|
||||||
msg = f"Error: unknown variable used in template {source} to {destfilename}: {varname}"
|
raise TemplateError(_(f"Error: unknown variable used in template {source} to {destfilename} : {varname}"))
|
||||||
raise TemplateError(_(msg))
|
|
||||||
except Exception as err: # pragma: no cover
|
except Exception as err: # pragma: no cover
|
||||||
msg = _(f"Error while instantiating template {source} to {destfilename}: {err}")
|
raise TemplateError(_(f"Error while instantiating template {source} to {destfilename}: {err}"))
|
||||||
raise TemplateError(msg)
|
|
||||||
|
|
||||||
with open(destfilename, 'w') as file_h:
|
with open(destfilename, 'w') as file_h:
|
||||||
file_h.write(data)
|
file_h.write(data)
|
||||||
|
@ -331,9 +366,10 @@ class CreoleTemplateEngine:
|
||||||
for option in await self.config.option.list(type='all'):
|
for option in await self.config.option.list(type='all'):
|
||||||
namespace = await option.option.name()
|
namespace = await option.option.name()
|
||||||
if namespace == Config['variable_namespace']:
|
if namespace == Config['variable_namespace']:
|
||||||
await self.load_variables_namespace(option)
|
await self.load_eole_variables_rougail(option)
|
||||||
else:
|
else:
|
||||||
self.rougail_variables_dict[namespace] = await self.load_variables_extra(option)
|
families = await self.load_eole_variables(option)
|
||||||
|
self.rougail_variables_dict[namespace] = families
|
||||||
for template in listdir('.'):
|
for template in listdir('.'):
|
||||||
self.prepare_template(template, tmp_dir, patch_dir)
|
self.prepare_template(template, tmp_dir, patch_dir)
|
||||||
for service_obj in await self.config.option('services').list('all'):
|
for service_obj in await self.config.option('services').list('all'):
|
||||||
|
@ -353,57 +389,6 @@ class CreoleTemplateEngine:
|
||||||
log.debug(_("Instantiation of file '{filename}' disabled"))
|
log.debug(_("Instantiation of file '{filename}' disabled"))
|
||||||
chdir(ori_dir)
|
chdir(ori_dir)
|
||||||
|
|
||||||
async def load_variables_namespace (self,
|
|
||||||
optiondescription,
|
|
||||||
):
|
|
||||||
"""load variables from the "variable namespace
|
|
||||||
"""
|
|
||||||
for option in await optiondescription.list('all'):
|
|
||||||
if await option.option.isoptiondescription():
|
|
||||||
if await option.option.isleadership():
|
|
||||||
for idx, suboption in enumerate(await option.list('all')):
|
|
||||||
if idx == 0:
|
|
||||||
leader = CreoleLeader(await suboption.value.get())
|
|
||||||
self.rougail_variables_dict[await suboption.option.name()] = leader
|
|
||||||
else:
|
|
||||||
await leader.add_follower(self.config,
|
|
||||||
await suboption.option.name(),
|
|
||||||
await suboption.option.path(),
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
await self.load_variables_namespace(option)
|
|
||||||
else:
|
|
||||||
self.rougail_variables_dict[await option.option.name()] = await option.value.get()
|
|
||||||
|
|
||||||
async def load_variables_extra(self,
|
|
||||||
optiondescription,
|
|
||||||
) -> CreoleExtra:
|
|
||||||
"""Load all variables and set it in CreoleExtra objects
|
|
||||||
"""
|
|
||||||
families = {}
|
|
||||||
for family in await optiondescription.list('all'):
|
|
||||||
variables = {}
|
|
||||||
for variable in await family.list('all'):
|
|
||||||
if await variable.option.isoptiondescription():
|
|
||||||
if await variable.option.isleadership():
|
|
||||||
for idx, suboption in enumerate(await variable.list('all')):
|
|
||||||
if idx == 0:
|
|
||||||
leader = CreoleLeader(await suboption.value.get())
|
|
||||||
leader_name = await suboption.option.name()
|
|
||||||
else:
|
|
||||||
await leader.add_follower(self.config,
|
|
||||||
await suboption.option.name(),
|
|
||||||
await suboption.option.path(),
|
|
||||||
)
|
|
||||||
variables[leader_name] = leader
|
|
||||||
else:
|
|
||||||
subfamilies = await self.load_variables_extra(variable)
|
|
||||||
variables[await variable.option.name()] = subfamilies
|
|
||||||
else:
|
|
||||||
variables[await variable.option.name()] = await variable.value.get()
|
|
||||||
families[await family.option.name()] = CreoleExtra(variables)
|
|
||||||
return CreoleExtra(families)
|
|
||||||
|
|
||||||
|
|
||||||
async def generate(config: Config,
|
async def generate(config: Config,
|
||||||
eosfunc_file: str,
|
eosfunc_file: str,
|
||||||
|
@ -411,8 +396,6 @@ async def generate(config: Config,
|
||||||
tmp_dir: str,
|
tmp_dir: str,
|
||||||
dest_dir: str,
|
dest_dir: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Generate all files
|
|
||||||
"""
|
|
||||||
engine = CreoleTemplateEngine(config,
|
engine = CreoleTemplateEngine(config,
|
||||||
eosfunc_file,
|
eosfunc_file,
|
||||||
distrib_dir,
|
distrib_dir,
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
"""Redefine Tiramisu object
|
|
||||||
"""
|
|
||||||
try:
|
try:
|
||||||
from tiramisu3 import DynOptionDescription
|
from tiramisu3 import DynOptionDescription
|
||||||
except ModuleNotFoundError:
|
except ModuleNotFoundError:
|
||||||
|
@ -8,9 +6,6 @@ from .utils import normalize_family
|
||||||
|
|
||||||
|
|
||||||
class ConvertDynOptionDescription(DynOptionDescription):
|
class ConvertDynOptionDescription(DynOptionDescription):
|
||||||
"""Suffix could be an integer, we should convert it in str
|
|
||||||
Suffix could also contain invalid character, so we should "normalize" it
|
|
||||||
"""
|
|
||||||
def convert_suffix_to_path(self, suffix):
|
def convert_suffix_to_path(self, suffix):
|
||||||
if not isinstance(suffix, str):
|
if not isinstance(suffix, str):
|
||||||
suffix = str(suffix)
|
suffix = str(suffix)
|
||||||
|
|
|
@ -2,86 +2,93 @@
|
||||||
flattened XML specific
|
flattened XML specific
|
||||||
"""
|
"""
|
||||||
from .config import Config
|
from .config import Config
|
||||||
|
from .i18n import _
|
||||||
|
from .error import LoaderError
|
||||||
from .annotator import ERASED_ATTRIBUTES, CONVERT_OPTION
|
from .annotator import ERASED_ATTRIBUTES, CONVERT_OPTION
|
||||||
#from .objspace import UnRedefinable, Redefinable, Atom
|
|
||||||
|
|
||||||
|
|
||||||
FUNC_TO_DICT = []
|
FUNC_TO_DICT = []
|
||||||
FORCE_INFORMATIONS = ['help', 'test', 'manage']
|
FORCE_INFORMATIONS = ['help', 'test', 'separator', 'manage']
|
||||||
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi')
|
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'multi')
|
||||||
|
|
||||||
|
|
||||||
class Root():
|
class Root():
|
||||||
"""Root classes
|
|
||||||
"""
|
|
||||||
path = '.'
|
path = '.'
|
||||||
|
|
||||||
|
|
||||||
class TiramisuReflector:
|
class TiramisuReflector:
|
||||||
"""Convert object to tiramisu representation
|
|
||||||
"""
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
space,
|
xmlroot,
|
||||||
funcs_path,
|
funcs_path,
|
||||||
):
|
):
|
||||||
self.index = 0
|
self.storage = ElementStorage()
|
||||||
self.text = ["from importlib.machinery import SourceFileLoader",
|
self.storage.text = ["from importlib.machinery import SourceFileLoader",
|
||||||
f"func = SourceFileLoader('func', '{funcs_path}').load_module()",
|
f"func = SourceFileLoader('func', '{funcs_path}').load_module()",
|
||||||
"for key, value in dict(locals()).items():",
|
"for key, value in dict(locals()).items():",
|
||||||
" if key != ['SourceFileLoader', 'func']:",
|
" if key != ['SourceFileLoader', 'func']:",
|
||||||
" setattr(func, key, value)",
|
" setattr(func, key, value)",
|
||||||
"try:",
|
"try:",
|
||||||
" from tiramisu3 import *",
|
" from tiramisu3 import *",
|
||||||
"except:",
|
"except:",
|
||||||
" from tiramisu import *",
|
" from tiramisu import *",
|
||||||
"from rougail.tiramisu import ConvertDynOptionDescription",
|
"from rougail.tiramisu import ConvertDynOptionDescription",
|
||||||
]
|
]
|
||||||
self.make_tiramisu_objects(space)
|
self.make_tiramisu_objects(xmlroot)
|
||||||
|
# parse object
|
||||||
|
self.storage.get(Root()).get()
|
||||||
|
|
||||||
def make_tiramisu_objects(self,
|
def make_tiramisu_objects(self,
|
||||||
space,
|
xmlroot,
|
||||||
):
|
):
|
||||||
"""make tiramisu objects
|
family = self.get_root_family()
|
||||||
"""
|
for xmlelt in self.reorder_family(xmlroot):
|
||||||
baseelt = BaseElt()
|
self.iter_family(xmlelt,
|
||||||
self.set_name(baseelt)
|
family,
|
||||||
basefamily = Family(baseelt,
|
None,
|
||||||
self.text,
|
|
||||||
)
|
|
||||||
for elt in self.reorder_family(space):
|
|
||||||
self.iter_family(basefamily,
|
|
||||||
elt,
|
|
||||||
)
|
)
|
||||||
# parse object
|
|
||||||
baseelt.reflector_object.get()
|
|
||||||
|
|
||||||
@staticmethod
|
def get_root_family(self):
|
||||||
def reorder_family(space):
|
family = Family(BaseElt(),
|
||||||
"""variable_namespace family has to be loaded before any other family
|
self.storage,
|
||||||
because `extra` family could use `variable_namespace` variables.
|
False,
|
||||||
"""
|
'.',
|
||||||
if hasattr(space, 'variables'):
|
)
|
||||||
if Config['variable_namespace'] in space.variables:
|
return family
|
||||||
yield space.variables[Config['variable_namespace']]
|
|
||||||
for elt, value in space.variables.items():
|
def reorder_family(self, xmlroot):
|
||||||
if elt != Config['variable_namespace']:
|
# variable_namespace family has to be loaded before any other family
|
||||||
|
# because `extra` family could use `variable_namespace` variables.
|
||||||
|
if hasattr(xmlroot, 'variables'):
|
||||||
|
if Config['variable_namespace'] in xmlroot.variables:
|
||||||
|
yield xmlroot.variables[Config['variable_namespace']]
|
||||||
|
for xmlelt, value in xmlroot.variables.items():
|
||||||
|
if xmlelt != Config['variable_namespace']:
|
||||||
yield value
|
yield value
|
||||||
if hasattr(space, 'services'):
|
if hasattr(xmlroot, 'services'):
|
||||||
yield space.services
|
yield xmlroot.services
|
||||||
|
|
||||||
def get_attributes(self, space): # pylint: disable=R0201
|
def get_attributes(self, space): # pylint: disable=R0201
|
||||||
"""Get attributes
|
|
||||||
"""
|
|
||||||
for attr in dir(space):
|
for attr in dir(space):
|
||||||
if not attr.startswith('_') and attr not in ERASED_ATTRIBUTES:
|
if not attr.startswith('_') and attr not in ERASED_ATTRIBUTES:
|
||||||
yield attr
|
yield attr
|
||||||
|
|
||||||
|
def get_children(self,
|
||||||
|
space,
|
||||||
|
):
|
||||||
|
for tag in self.get_attributes(space):
|
||||||
|
children = getattr(space, tag)
|
||||||
|
if children.__class__.__name__ == 'Family':
|
||||||
|
children = [children]
|
||||||
|
if isinstance(children, dict):
|
||||||
|
children = list(children.values())
|
||||||
|
if isinstance(children, list):
|
||||||
|
yield tag, children
|
||||||
|
|
||||||
def iter_family(self,
|
def iter_family(self,
|
||||||
family,
|
|
||||||
child,
|
child,
|
||||||
|
family,
|
||||||
|
subpath,
|
||||||
):
|
):
|
||||||
"""Iter each family
|
|
||||||
"""
|
|
||||||
tag = child.__class__.__name__
|
tag = child.__class__.__name__
|
||||||
if tag == 'Variable':
|
if tag == 'Variable':
|
||||||
function = self.populate_variable
|
function = self.populate_variable
|
||||||
|
@ -90,104 +97,112 @@ class TiramisuReflector:
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
function = self.populate_family
|
function = self.populate_family
|
||||||
|
#else:
|
||||||
|
# raise Exception('unknown tag {}'.format(child.tag))
|
||||||
function(family,
|
function(family,
|
||||||
child,
|
child,
|
||||||
|
subpath,
|
||||||
)
|
)
|
||||||
|
|
||||||
def populate_family(self,
|
def populate_family(self,
|
||||||
parent_family,
|
parent_family,
|
||||||
elt,
|
elt,
|
||||||
|
subpath,
|
||||||
):
|
):
|
||||||
"""Populate family
|
path = self.build_path(subpath,
|
||||||
"""
|
elt,
|
||||||
self.set_name(elt)
|
)
|
||||||
|
tag = elt.__class__.__name__
|
||||||
family = Family(elt,
|
family = Family(elt,
|
||||||
self.text,
|
self.storage,
|
||||||
|
tag == 'Leadership',
|
||||||
|
path,
|
||||||
)
|
)
|
||||||
parent_family.add(family)
|
parent_family.add(family)
|
||||||
for children in self.get_children(elt):
|
for tag, children in self.get_children(elt):
|
||||||
for child in children:
|
for child in children:
|
||||||
self.iter_family(family,
|
self.iter_family(child,
|
||||||
child,
|
family,
|
||||||
|
path,
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_children(self,
|
|
||||||
space,
|
|
||||||
):
|
|
||||||
"""Get children
|
|
||||||
"""
|
|
||||||
for tag in self.get_attributes(space):
|
|
||||||
children = getattr(space, tag)
|
|
||||||
if children.__class__.__name__ == 'Family':
|
|
||||||
children = [children]
|
|
||||||
if isinstance(children, dict):
|
|
||||||
children = list(children.values())
|
|
||||||
if isinstance(children, list):
|
|
||||||
yield children
|
|
||||||
|
|
||||||
def populate_variable(self,
|
def populate_variable(self,
|
||||||
family,
|
family,
|
||||||
elt,
|
elt,
|
||||||
|
subpath,
|
||||||
):
|
):
|
||||||
"""Populate variable
|
is_follower = False
|
||||||
"""
|
is_leader = False
|
||||||
if family.is_leadership:
|
if family.is_leader:
|
||||||
is_leader = elt.name == family.elt.variable[0].name
|
if elt.name != family.elt.name:
|
||||||
is_follower = not is_leader
|
is_follower = True
|
||||||
else:
|
else:
|
||||||
is_leader = False
|
is_leader = True
|
||||||
is_follower = False
|
|
||||||
self.set_name(elt)
|
|
||||||
family.add(Variable(elt,
|
family.add(Variable(elt,
|
||||||
self.text,
|
self.storage,
|
||||||
is_follower,
|
is_follower,
|
||||||
is_leader,
|
is_leader,
|
||||||
|
self.build_path(subpath,
|
||||||
|
elt,
|
||||||
|
)
|
||||||
))
|
))
|
||||||
|
|
||||||
def set_name(self,
|
def build_path(self,
|
||||||
elt,
|
subpath,
|
||||||
):
|
elt,
|
||||||
"""Set name
|
):
|
||||||
"""
|
if subpath is None:
|
||||||
elt.reflector_name = f'option_{self.index}'
|
return elt.name
|
||||||
self.index += 1
|
return subpath + '.' + elt.name
|
||||||
|
|
||||||
def get_text(self):
|
def get_text(self):
|
||||||
"""Get text
|
return '\n'.join(self.storage.get(Root()).get_text())
|
||||||
"""
|
|
||||||
return '\n'.join(self.text)
|
|
||||||
|
|
||||||
|
|
||||||
class BaseElt:
|
class BaseElt:
|
||||||
"""Base element
|
def __init__(self) -> None:
|
||||||
"""
|
self.name = 'baseoption'
|
||||||
name = 'baseoption'
|
self.doc = 'baseoption'
|
||||||
doc = 'baseoption'
|
|
||||||
path = '.'
|
|
||||||
|
class ElementStorage:
|
||||||
|
def __init__(self,
|
||||||
|
):
|
||||||
|
self.paths = {}
|
||||||
|
self.text = []
|
||||||
|
self.index = 0
|
||||||
|
|
||||||
|
def add(self, path, elt):
|
||||||
|
self.paths[path] = (elt, self.index)
|
||||||
|
self.index += 1
|
||||||
|
|
||||||
|
def get(self, obj):
|
||||||
|
path = obj.path
|
||||||
|
return self.paths[path][0]
|
||||||
|
|
||||||
|
def get_name(self, path):
|
||||||
|
return f'option_{self.paths[path][1]}'
|
||||||
|
|
||||||
|
|
||||||
class Common:
|
class Common:
|
||||||
"""Common function for variable and family
|
|
||||||
"""
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
elt,
|
storage,
|
||||||
text,
|
is_leader,
|
||||||
|
path,
|
||||||
):
|
):
|
||||||
self.elt = elt
|
|
||||||
self.option_name = None
|
self.option_name = None
|
||||||
|
self.path = path
|
||||||
self.attrib = {}
|
self.attrib = {}
|
||||||
self.informations = {}
|
self.informations = {}
|
||||||
self.text = text
|
self.storage = storage
|
||||||
self.elt.reflector_object = self
|
self.is_leader = is_leader
|
||||||
|
self.storage.add(self.path, self)
|
||||||
|
|
||||||
def populate_properties(self, child):
|
def populate_properties(self, child):
|
||||||
"""Populate properties
|
|
||||||
"""
|
|
||||||
assert child.type == 'calculation'
|
assert child.type == 'calculation'
|
||||||
action = f"ParamValue('{child.name}')"
|
action = f"ParamValue('{child.name}')"
|
||||||
option_name = child.source.reflector_object.get()
|
option_name = self.storage.get(child.source).get()
|
||||||
kwargs = (f"'condition': ParamOption({option_name}, todict=True), "
|
kwargs = f"'condition': ParamOption({option_name}, todict=True), 'expected': ParamValue('{child.expected}')"
|
||||||
f"'expected': ParamValue('{child.expected}')")
|
|
||||||
if child.inverse:
|
if child.inverse:
|
||||||
kwargs += ", 'reverse_condition': ParamValue(True)"
|
kwargs += ", 'reverse_condition': ParamValue(True)"
|
||||||
prop = 'Calculation(calc_value, Params(' + action + ', kwargs={' + kwargs + '}))'
|
prop = 'Calculation(calc_value, Params(' + action + ', kwargs={' + kwargs + '}))'
|
||||||
|
@ -195,17 +210,7 @@ class Common:
|
||||||
self.attrib['properties'] += ', '
|
self.attrib['properties'] += ', '
|
||||||
self.attrib['properties'] += prop
|
self.attrib['properties'] += prop
|
||||||
|
|
||||||
def properties_to_string(self):
|
|
||||||
"""Change properties to string
|
|
||||||
"""
|
|
||||||
if not self.attrib['properties']:
|
|
||||||
self.attrib['properties'] = ''
|
|
||||||
else:
|
|
||||||
self.attrib['properties'] = "'" + "', '".join(sorted(self.attrib['properties'])) + "'"
|
|
||||||
|
|
||||||
def get_attrib(self):
|
def get_attrib(self):
|
||||||
"""Get attributes
|
|
||||||
"""
|
|
||||||
ret_list = []
|
ret_list = []
|
||||||
for key, value in self.attrib.items():
|
for key, value in self.attrib.items():
|
||||||
if value is None:
|
if value is None:
|
||||||
|
@ -222,16 +227,16 @@ class Common:
|
||||||
return ', '.join(ret_list)
|
return ', '.join(ret_list)
|
||||||
|
|
||||||
def populate_informations(self):
|
def populate_informations(self):
|
||||||
"""Populate Tiramisu's informations
|
|
||||||
"""
|
|
||||||
for key, value in self.informations.items():
|
for key, value in self.informations.items():
|
||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
value = '"' + value.replace('"', '\"') + '"'
|
value = '"' + value.replace('"', '\"') + '"'
|
||||||
self.text.append(f'{self.option_name}.impl_set_information("{key}", {value})')
|
self.storage.text.append(f'{self.option_name}.impl_set_information("{key}", {value})')
|
||||||
|
|
||||||
|
def get_text(self,
|
||||||
|
):
|
||||||
|
return self.storage.text
|
||||||
|
|
||||||
def get_attributes(self, space): # pylint: disable=R0201
|
def get_attributes(self, space): # pylint: disable=R0201
|
||||||
"""Get attributes
|
|
||||||
"""
|
|
||||||
attributes = dir(space)
|
attributes = dir(space)
|
||||||
for attr in ATTRIBUTES_ORDER:
|
for attr in ATTRIBUTES_ORDER:
|
||||||
if attr in attributes:
|
if attr in attributes:
|
||||||
|
@ -240,14 +245,12 @@ class Common:
|
||||||
if attr not in ATTRIBUTES_ORDER:
|
if attr not in ATTRIBUTES_ORDER:
|
||||||
if not attr.startswith('_') and attr not in ERASED_ATTRIBUTES:
|
if not attr.startswith('_') and attr not in ERASED_ATTRIBUTES:
|
||||||
value = getattr(space, attr)
|
value = getattr(space, attr)
|
||||||
if not isinstance(value, (list, dict)) and \
|
if not isinstance(value, (list, dict)) and not value.__class__.__name__ == 'Family':
|
||||||
not value.__class__.__name__ == 'Family':
|
|
||||||
yield attr
|
yield attr
|
||||||
|
|
||||||
@staticmethod
|
def get_children(self,
|
||||||
def get_children(space):
|
space,
|
||||||
"""Get children
|
):
|
||||||
"""
|
|
||||||
for attr in dir(space):
|
for attr in dir(space):
|
||||||
if not attr.startswith('_') and attr not in ERASED_ATTRIBUTES:
|
if not attr.startswith('_') and attr not in ERASED_ATTRIBUTES:
|
||||||
if isinstance(getattr(space, attr), list):
|
if isinstance(getattr(space, attr), list):
|
||||||
|
@ -255,16 +258,17 @@ class Common:
|
||||||
|
|
||||||
|
|
||||||
class Variable(Common):
|
class Variable(Common):
|
||||||
"""Manage variable
|
|
||||||
"""
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
elt,
|
elt,
|
||||||
text,
|
storage,
|
||||||
is_follower,
|
is_follower,
|
||||||
is_leader,
|
is_leader,
|
||||||
|
path,
|
||||||
):
|
):
|
||||||
super().__init__(elt, text)
|
super().__init__(storage,
|
||||||
self.is_leader = is_leader
|
is_leader,
|
||||||
|
path,
|
||||||
|
)
|
||||||
self.is_follower = is_follower
|
self.is_follower = is_follower
|
||||||
convert_option = CONVERT_OPTION[elt.type]
|
convert_option = CONVERT_OPTION[elt.type]
|
||||||
self.object_type = convert_option['opttype']
|
self.object_type = convert_option['opttype']
|
||||||
|
@ -272,25 +276,22 @@ class Variable(Common):
|
||||||
if self.object_type != 'SymLinkOption':
|
if self.object_type != 'SymLinkOption':
|
||||||
self.attrib['properties'] = []
|
self.attrib['properties'] = []
|
||||||
self.attrib['validators'] = []
|
self.attrib['validators'] = []
|
||||||
|
self.elt = elt
|
||||||
|
|
||||||
def get(self):
|
def get(self):
|
||||||
"""Get tiramisu's object
|
|
||||||
"""
|
|
||||||
if self.option_name is None:
|
if self.option_name is None:
|
||||||
self.populate_attrib()
|
self.populate_attrib()
|
||||||
if self.object_type == 'SymLinkOption':
|
if self.object_type == 'SymLinkOption':
|
||||||
self.attrib['opt'] = self.attrib['opt'].reflector_object.get()
|
self.attrib['opt'] = self.storage.get(self.attrib['opt']).get()
|
||||||
else:
|
else:
|
||||||
self.parse_children()
|
self.parse_children()
|
||||||
attrib = self.get_attrib()
|
attrib = self.get_attrib()
|
||||||
self.option_name = self.elt.reflector_name
|
self.option_name = self.storage.get_name(self.path)
|
||||||
self.text.append(f'{self.option_name} = {self.object_type}({attrib})')
|
self.storage.text.append(f'{self.option_name} = {self.object_type}({attrib})')
|
||||||
self.populate_informations()
|
self.populate_informations()
|
||||||
return self.option_name
|
return self.option_name
|
||||||
|
|
||||||
def populate_attrib(self):
|
def populate_attrib(self):
|
||||||
"""Populate attributes
|
|
||||||
"""
|
|
||||||
for key in self.get_attributes(self.elt):
|
for key in self.get_attributes(self.elt):
|
||||||
value = getattr(self.elt, key)
|
value = getattr(self.elt, key)
|
||||||
if key in FORCE_INFORMATIONS:
|
if key in FORCE_INFORMATIONS:
|
||||||
|
@ -305,68 +306,48 @@ class Variable(Common):
|
||||||
self.attrib[key] = value
|
self.attrib[key] = value
|
||||||
|
|
||||||
def parse_children(self):
|
def parse_children(self):
|
||||||
"""Parse children
|
|
||||||
"""
|
|
||||||
if 'default' not in self.attrib or self.attrib['multi']:
|
if 'default' not in self.attrib or self.attrib['multi']:
|
||||||
self.attrib['default'] = []
|
self.attrib['default'] = []
|
||||||
if self.attrib['multi'] == 'submulti' and self.is_follower:
|
if self.attrib['multi'] == 'submulti' and self.is_follower:
|
||||||
self.attrib['default_multi'] = []
|
self.attrib['default_multi'] = []
|
||||||
choices = []
|
choices = []
|
||||||
self.properties_to_string()
|
if 'properties' in self.attrib:
|
||||||
|
if self.attrib['properties']:
|
||||||
|
self.attrib['properties'] = "'" + "', '".join(sorted(list(self.attrib['properties']))) + "'"
|
||||||
|
else:
|
||||||
|
self.attrib['properties'] = ''
|
||||||
for tag, children in self.get_children(self.elt):
|
for tag, children in self.get_children(self.elt):
|
||||||
for child in children:
|
for child in children:
|
||||||
self.parse_child(tag,
|
if tag == 'property':
|
||||||
child,
|
self.populate_properties(child)
|
||||||
choices,
|
elif tag == 'value':
|
||||||
)
|
if child.type == 'calculation':
|
||||||
|
self.attrib['default'] = self.calculation_value(child, [])
|
||||||
|
else:
|
||||||
|
self.populate_value(child)
|
||||||
|
elif tag == 'check':
|
||||||
|
self.attrib['validators'].append(self.calculation_value(child, ['ParamSelfOption()']))
|
||||||
|
elif tag == 'choice':
|
||||||
|
if child.type == 'calculation':
|
||||||
|
value = self.storage.get(child.name).get()
|
||||||
|
choices = f"Calculation(func.calc_value, Params((ParamOption({value}))))"
|
||||||
|
else:
|
||||||
|
choices.append(child.name)
|
||||||
if choices:
|
if choices:
|
||||||
self.attrib['values'] = str(tuple(choices))
|
if isinstance(choices, list):
|
||||||
if not self.attrib['default']:
|
self.attrib['values'] = str(tuple(choices))
|
||||||
|
else:
|
||||||
|
self.attrib['values'] = choices
|
||||||
|
if self.attrib['default'] == []:
|
||||||
del self.attrib['default']
|
del self.attrib['default']
|
||||||
elif not self.attrib['multi'] and isinstance(self.attrib['default'], list):
|
elif not self.attrib['multi'] and isinstance(self.attrib['default'], list):
|
||||||
self.attrib['default'] = self.attrib['default'][-1]
|
self.attrib['default'] = self.attrib['default'][-1]
|
||||||
if not self.attrib['validators']:
|
if self.attrib['validators'] == []:
|
||||||
del self.attrib['validators']
|
del self.attrib['validators']
|
||||||
else:
|
else:
|
||||||
self.attrib['validators'] = '[' + ', '.join(self.attrib['validators']) + ']'
|
self.attrib['validators'] = '[' + ', '.join(self.attrib['validators']) + ']'
|
||||||
|
|
||||||
def parse_child(self,
|
def calculation_value(self, child, args):
|
||||||
tag,
|
|
||||||
child,
|
|
||||||
choices,
|
|
||||||
) -> None:
|
|
||||||
"""Parse child
|
|
||||||
"""
|
|
||||||
if tag == 'property':
|
|
||||||
self.populate_properties(child)
|
|
||||||
elif tag == 'value':
|
|
||||||
self.populate_value(child)
|
|
||||||
elif tag == 'check':
|
|
||||||
validator = self.calculation_value(child, ['ParamSelfOption()'])
|
|
||||||
self.attrib['validators'].append(validator)
|
|
||||||
elif tag == 'choice':
|
|
||||||
self.calculate_choice(child,
|
|
||||||
choices,
|
|
||||||
)
|
|
||||||
|
|
||||||
def calculate_choice(self,
|
|
||||||
child,
|
|
||||||
choices: list,
|
|
||||||
) -> None:
|
|
||||||
"""Calculating choice
|
|
||||||
"""
|
|
||||||
if child.type == 'calculation':
|
|
||||||
value = child.name.reflector_object.get()
|
|
||||||
self.attrib['values'] = f"Calculation(func.calc_value, Params((ParamOption({value}))))"
|
|
||||||
else:
|
|
||||||
choices.append(child.name)
|
|
||||||
|
|
||||||
def calculation_value(self,
|
|
||||||
child,
|
|
||||||
args,
|
|
||||||
) -> str:
|
|
||||||
"""Generate calculated value
|
|
||||||
"""
|
|
||||||
kwargs = []
|
kwargs = []
|
||||||
# has parameters
|
# has parameters
|
||||||
function = child.name
|
function = child.name
|
||||||
|
@ -377,8 +358,7 @@ class Variable(Common):
|
||||||
args.append(str(value))
|
args.append(str(value))
|
||||||
else:
|
else:
|
||||||
kwargs.append(f"'{param.name}': " + value)
|
kwargs.append(f"'{param.name}': " + value)
|
||||||
ret = f"Calculation(func.{function}, Params((" + ', '.join(args) + \
|
ret = f"Calculation(func.{function}, Params((" + ', '.join(args) + "), kwargs=" + "{" + ', '.join(kwargs) + "})"
|
||||||
"), kwargs=" + "{" + ', '.join(kwargs) + "})"
|
|
||||||
if hasattr(child, 'warnings_only'):
|
if hasattr(child, 'warnings_only'):
|
||||||
ret += f', warnings_only={child.warnings_only}'
|
ret += f', warnings_only={child.warnings_only}'
|
||||||
return ret + ')'
|
return ret + ')'
|
||||||
|
@ -387,8 +367,6 @@ class Variable(Common):
|
||||||
function: str,
|
function: str,
|
||||||
param,
|
param,
|
||||||
):
|
):
|
||||||
"""Populate variable parameters
|
|
||||||
"""
|
|
||||||
if param.type == 'string':
|
if param.type == 'string':
|
||||||
return f'ParamValue("{param.text}")'
|
return f'ParamValue("{param.text}")'
|
||||||
if param.type == 'number':
|
if param.type == 'number':
|
||||||
|
@ -400,106 +378,90 @@ class Variable(Common):
|
||||||
}
|
}
|
||||||
if hasattr(param, 'suffix'):
|
if hasattr(param, 'suffix'):
|
||||||
value['suffix'] = param.suffix
|
value['suffix'] = param.suffix
|
||||||
value['family'] = param.family
|
|
||||||
return self.build_param(value)
|
return self.build_param(value)
|
||||||
if param.type == 'information':
|
if param.type == 'information':
|
||||||
return f'ParamInformation("{param.text}", None)'
|
return f'ParamInformation("{param.text}", None)'
|
||||||
if param.type == 'suffix':
|
if param.type == 'suffix':
|
||||||
return 'ParamSuffix()'
|
return 'ParamSuffix()'
|
||||||
return '' # pragma: no cover
|
raise LoaderError(_('unknown param type {}').format(param.type)) # pragma: no cover
|
||||||
|
|
||||||
def populate_value(self,
|
def populate_value(self,
|
||||||
child,
|
child,
|
||||||
):
|
):
|
||||||
"""Populate variable's values
|
value = child.name
|
||||||
"""
|
if self.attrib['multi'] == 'submulti':
|
||||||
if child.type == 'calculation':
|
self.attrib['default_multi'].append(value)
|
||||||
self.attrib['default'] = self.calculation_value(child, [])
|
elif self.is_follower:
|
||||||
else:
|
self.attrib['default_multi'] = value
|
||||||
value = child.name
|
elif self.attrib['multi']:
|
||||||
if self.attrib['multi'] == 'submulti':
|
self.attrib['default'].append(value)
|
||||||
self.attrib['default_multi'].append(value)
|
if not self.is_leader:
|
||||||
elif self.is_follower:
|
|
||||||
self.attrib['default_multi'] = value
|
self.attrib['default_multi'] = value
|
||||||
elif self.attrib['multi']:
|
elif isinstance(value, (int, float)) or value is None:
|
||||||
self.attrib['default'].append(value)
|
self.attrib['default'].append(value)
|
||||||
if not self.is_leader:
|
else:
|
||||||
self.attrib['default_multi'] = value
|
self.attrib['default'].append("'" + value + "'")
|
||||||
elif isinstance(value, (int, float)) or value is None:
|
|
||||||
self.attrib['default'].append(value)
|
|
||||||
else:
|
|
||||||
self.attrib['default'].append("'" + value + "'")
|
|
||||||
|
|
||||||
@staticmethod
|
def build_param(self,
|
||||||
def build_param(param) -> str:
|
param,
|
||||||
"""build variable parameters
|
):
|
||||||
"""
|
option_name = self.storage.get(param['option']).get()
|
||||||
option_name = param['option'].reflector_object.get()
|
|
||||||
ends = f"notraisepropertyerror={param['notraisepropertyerror']}, todict={param['todict']})"
|
|
||||||
if 'suffix' in param:
|
if 'suffix' in param:
|
||||||
family_name = param['family'].reflector_name
|
family = '.'.join(param['option'].path.split('.')[:-1])
|
||||||
return f"ParamDynOption({option_name}, '{param['suffix']}', {family_name}, {ends}"
|
family_option = self.storage.get_name(family)
|
||||||
return f"ParamOption({option_name}, {ends}"
|
return f"ParamDynOption({option_name}, '{param['suffix']}', {family_option}, notraisepropertyerror={param['notraisepropertyerror']}, todict={param['todict']})"
|
||||||
|
return f"ParamOption({option_name}, notraisepropertyerror={param['notraisepropertyerror']}, todict={param['todict']})"
|
||||||
|
|
||||||
|
|
||||||
class Family(Common):
|
class Family(Common):
|
||||||
"""Manage family
|
|
||||||
"""
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
elt,
|
elt,
|
||||||
text,
|
storage,
|
||||||
|
is_leader,
|
||||||
|
path,
|
||||||
):
|
):
|
||||||
super().__init__(elt, text)
|
super().__init__(storage,
|
||||||
self.is_leadership = self.elt.__class__.__name__ == 'Leadership'
|
is_leader,
|
||||||
|
path,
|
||||||
|
)
|
||||||
self.children = []
|
self.children = []
|
||||||
|
self.elt = elt
|
||||||
|
|
||||||
def add(self, child):
|
def add(self, child):
|
||||||
"""Add a child
|
|
||||||
"""
|
|
||||||
self.children.append(child)
|
self.children.append(child)
|
||||||
|
|
||||||
def get(self):
|
def get(self):
|
||||||
"""Get tiramisu's object
|
|
||||||
"""
|
|
||||||
if not self.option_name:
|
if not self.option_name:
|
||||||
self.populate_attrib()
|
self.populate_attrib()
|
||||||
self.parse_children()
|
self.parse_children()
|
||||||
self.option_name = self.elt.reflector_name
|
self.option_name = self.storage.get_name(self.path)
|
||||||
object_name = self.get_object_name()
|
object_name = self.get_object_name()
|
||||||
attrib = self.get_attrib() + \
|
attrib = self.get_attrib() + ', children=[' + ', '.join([child.get() for child in self.children]) + ']'
|
||||||
', children=[' + ', '.join([child.get() for child in self.children]) + ']'
|
self.storage.text.append(f'{self.option_name} = {object_name}({attrib})')
|
||||||
self.text.append(f'{self.option_name} = {object_name}({attrib})')
|
|
||||||
self.populate_informations()
|
self.populate_informations()
|
||||||
return self.option_name
|
return self.option_name
|
||||||
|
|
||||||
def populate_attrib(self):
|
def populate_attrib(self):
|
||||||
"""parse a populate attributes
|
|
||||||
"""
|
|
||||||
for key in self.get_attributes(self.elt):
|
for key in self.get_attributes(self.elt):
|
||||||
value = getattr(self.elt, key)
|
value = getattr(self.elt, key)
|
||||||
if key in FORCE_INFORMATIONS:
|
if key in FORCE_INFORMATIONS:
|
||||||
self.informations[key] = value
|
self.informations[key] = value
|
||||||
elif key == 'dynamic':
|
elif key == 'dynamic':
|
||||||
dynamic = value.reflector_object.get()
|
dynamic = self.storage.get(value).get()
|
||||||
self.attrib['suffixes'] = \
|
self.attrib['suffixes'] = f"Calculation(func.calc_value, Params((ParamOption({dynamic}))))"
|
||||||
f"Calculation(func.calc_value, Params((ParamOption({dynamic}))))"
|
|
||||||
else:
|
else:
|
||||||
self.attrib[key] = value
|
self.attrib[key] = value
|
||||||
|
|
||||||
def parse_children(self):
|
def parse_children(self):
|
||||||
"""parse current children
|
|
||||||
"""
|
|
||||||
if 'properties' in self.attrib:
|
if 'properties' in self.attrib:
|
||||||
self.properties_to_string()
|
self.attrib['properties'] = "'" + "', '".join(sorted(list(self.attrib['properties']))) + "'"
|
||||||
if hasattr(self.elt, 'property'):
|
if hasattr(self.elt, 'property'):
|
||||||
for child in self.elt.property:
|
for child in self.elt.property:
|
||||||
self.populate_properties(child)
|
self.populate_properties(child)
|
||||||
|
|
||||||
def get_object_name(self):
|
def get_object_name(self):
|
||||||
"""Get family object's name
|
|
||||||
"""
|
|
||||||
if 'suffixes' in self.attrib:
|
if 'suffixes' in self.attrib:
|
||||||
return 'ConvertDynOptionDescription'
|
return 'ConvertDynOptionDescription'
|
||||||
if self.is_leadership:
|
if not self.is_leader:
|
||||||
return 'Leadership'
|
return 'OptionDescription'
|
||||||
return 'OptionDescription'
|
return 'Leadership'
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
"""
|
"""
|
||||||
utilitaires créole
|
utilitaires créole
|
||||||
"""
|
"""
|
||||||
from typing import List
|
|
||||||
from unicodedata import normalize, combining
|
from unicodedata import normalize, combining
|
||||||
|
|
||||||
from importlib.machinery import SourceFileLoader
|
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
|
||||||
|
|
||||||
|
|
||||||
def normalize_family(family_name: str) -> str:
|
def normalize_family(family_name: str) -> str:
|
||||||
"""replace space, accent, uppercase, ... by valid character
|
"""replace space, accent, uppercase, ... by valid character
|
||||||
|
@ -15,13 +11,3 @@ def normalize_family(family_name: str) -> str:
|
||||||
nfkd_form = normalize('NFKD', family_name)
|
nfkd_form = normalize('NFKD', family_name)
|
||||||
family_name = ''.join([c for c in nfkd_form if not combining(c)])
|
family_name = ''.join([c for c in nfkd_form if not combining(c)])
|
||||||
return family_name.lower()
|
return family_name.lower()
|
||||||
|
|
||||||
|
|
||||||
def load_modules(eosfunc_file) -> List[str]:
|
|
||||||
"""list all functions in eosfunc
|
|
||||||
"""
|
|
||||||
loader = SourceFileLoader('eosfunc', eosfunc_file)
|
|
||||||
spec = spec_from_loader(loader.name, loader)
|
|
||||||
eosfunc = module_from_spec(spec)
|
|
||||||
loader.exec_module(eosfunc)
|
|
||||||
return eosfunc
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name="calc_val" target="mode_conteneur_actif">
|
<fill name="calc_val" target="mode_conteneur_actif">
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<value>0.527</value>
|
<value>0.527</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
<constraints>
|
<constraints>
|
||||||
<fill name="calc_val" target="mode_conteneur_actif">
|
<fill name="calc_val" target="mode_conteneur_actif">
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
|
<value>non</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
<separators>
|
||||||
|
<separator name="mode_conteneur_actif">Établissement</separator>
|
||||||
|
</separators>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
|
@ -0,0 +1 @@
|
||||||
|
{"rougail.general.mode_conteneur_actif": "non"}
|
|
@ -0,0 +1,15 @@
|
||||||
|
from importlib.machinery import SourceFileLoader
|
||||||
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
|
for key, value in dict(locals()).items():
|
||||||
|
if key != ['SourceFileLoader', 'func']:
|
||||||
|
setattr(func, key, value)
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
from rougail.tiramisu import ConvertDynOptionDescription
|
||||||
|
option_3 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non')
|
||||||
|
option_3.impl_set_information("separator", "Établissement")
|
||||||
|
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
|
||||||
|
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||||
|
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
|
<value>non</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
<separators>
|
||||||
|
<separator name="mode_conteneur_actif">Établissement</separator>
|
||||||
|
</separators>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
|
@ -0,0 +1 @@
|
||||||
|
{"rougail.general.mode_conteneur_actif": "non"}
|
|
@ -0,0 +1,15 @@
|
||||||
|
from importlib.machinery import SourceFileLoader
|
||||||
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
|
for key, value in dict(locals()).items():
|
||||||
|
if key != ['SourceFileLoader', 'func']:
|
||||||
|
setattr(func, key, value)
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
from rougail.tiramisu import ConvertDynOptionDescription
|
||||||
|
option_3 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non')
|
||||||
|
option_3.impl_set_information("separator", "Établissement")
|
||||||
|
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
|
||||||
|
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||||
|
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
|
@ -4,6 +4,7 @@
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="mode_conteneur_actif3" redefine="True"/>
|
<variable name="mode_conteneur_actif3" redefine="True"/>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
|
||||||
<rougail>
|
|
||||||
<variables>
|
|
||||||
<family name="general">
|
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change">
|
|
||||||
<value>non</value>
|
|
||||||
</variable>
|
|
||||||
</family>
|
|
||||||
<family name="general1">
|
|
||||||
<variable name="leader" type="string" description="leader" multi="True" hidden="True"/>
|
|
||||||
<variable name="follower1" type="string" description="follower1"/>
|
|
||||||
<variable name="follower2" type="string" description="follower2"/>
|
|
||||||
</family>
|
|
||||||
</variables>
|
|
||||||
|
|
||||||
<constraints>
|
|
||||||
<fill name="calc_val" target="follower1">
|
|
||||||
<param name="valeur">valfill</param>
|
|
||||||
</fill>
|
|
||||||
<fill name="calc_val" target="follower2">
|
|
||||||
<param type="variable">follower1</param>
|
|
||||||
</fill>
|
|
||||||
<group leader="leader">
|
|
||||||
<follower>follower1</follower>
|
|
||||||
<follower>follower2</follower>
|
|
||||||
</group>
|
|
||||||
</constraints>
|
|
||||||
</rougail>
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
|
||||||
<rougail>
|
|
||||||
<variables>
|
|
||||||
<family name="general1">
|
|
||||||
<variable name="follower3" type="string" description="follower3"/>
|
|
||||||
</family>
|
|
||||||
</variables>
|
|
||||||
|
|
||||||
<constraints>
|
|
||||||
<group leader="leader">
|
|
||||||
<follower>follower3</follower>
|
|
||||||
</group>
|
|
||||||
</constraints>
|
|
||||||
</rougail>
|
|
|
@ -1 +0,0 @@
|
||||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leader.leader": []}
|
|
|
@ -1,20 +0,0 @@
|
||||||
from importlib.machinery import SourceFileLoader
|
|
||||||
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
|
||||||
for key, value in dict(locals()).items():
|
|
||||||
if key != ['SourceFileLoader', 'func']:
|
|
||||||
setattr(func, key, value)
|
|
||||||
try:
|
|
||||||
from tiramisu3 import *
|
|
||||||
except:
|
|
||||||
from tiramisu import *
|
|
||||||
from rougail.tiramisu import ConvertDynOptionDescription
|
|
||||||
option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non')
|
|
||||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
|
|
||||||
option_6 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen'}), name='leader', doc='leader', multi=True)
|
|
||||||
option_7 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'normal'}), name='follower1', doc='follower1', multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})))
|
|
||||||
option_8 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'normal'}), name='follower2', doc='follower2', multi=True, default=Calculation(func.calc_val, Params((ParamOption(option_7, notraisepropertyerror=False, todict=False)), kwargs={})))
|
|
||||||
option_9 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'normal'}), name='follower3', doc='follower3', multi=True)
|
|
||||||
option_5 = Leadership(name='leader', doc='leader', properties=frozenset({'hidden', 'normal'}), children=[option_6, option_7, option_8, option_9])
|
|
||||||
option_4 = OptionDescription(name='general1', doc='general1', properties=frozenset({'normal'}), children=[option_5])
|
|
||||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4])
|
|
||||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
|
|
@ -1,28 +0,0 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
|
||||||
<rougail>
|
|
||||||
<variables>
|
|
||||||
<family name="general">
|
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change">
|
|
||||||
<value>non</value>
|
|
||||||
</variable>
|
|
||||||
</family>
|
|
||||||
<family name="general1">
|
|
||||||
<variable name="leader" type="string" description="leader" multi="True"/>
|
|
||||||
<variable name="follower1" type="string" description="follower1"/>
|
|
||||||
<variable name="follower2" type="string" description="follower2"/>
|
|
||||||
</family>
|
|
||||||
</variables>
|
|
||||||
|
|
||||||
<constraints>
|
|
||||||
<fill name="calc_val" target="follower1">
|
|
||||||
<param name="valeur">valfill</param>
|
|
||||||
</fill>
|
|
||||||
<fill name="calc_val" target="follower2">
|
|
||||||
<param type="variable">follower1</param>
|
|
||||||
</fill>
|
|
||||||
<group leader="leader" name="leadership">
|
|
||||||
<follower>follower1</follower>
|
|
||||||
<follower>follower2</follower>
|
|
||||||
</group>
|
|
||||||
</constraints>
|
|
||||||
</rougail>
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
|
||||||
<rougail>
|
|
||||||
<variables>
|
|
||||||
<family name="general1">
|
|
||||||
<variable name="follower3" type="string" description="follower3"/>
|
|
||||||
</family>
|
|
||||||
</variables>
|
|
||||||
|
|
||||||
<constraints>
|
|
||||||
<group leader="leader">
|
|
||||||
<follower>follower3</follower>
|
|
||||||
</group>
|
|
||||||
</constraints>
|
|
||||||
</rougail>
|
|
|
@ -1 +0,0 @@
|
||||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general1.leadership.leader": []}
|
|
|
@ -1,20 +0,0 @@
|
||||||
from importlib.machinery import SourceFileLoader
|
|
||||||
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
|
||||||
for key, value in dict(locals()).items():
|
|
||||||
if key != ['SourceFileLoader', 'func']:
|
|
||||||
setattr(func, key, value)
|
|
||||||
try:
|
|
||||||
from tiramisu3 import *
|
|
||||||
except:
|
|
||||||
from tiramisu import *
|
|
||||||
from rougail.tiramisu import ConvertDynOptionDescription
|
|
||||||
option_3 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non')
|
|
||||||
option_2 = OptionDescription(name='general', doc='general', properties=frozenset({'normal'}), children=[option_3])
|
|
||||||
option_6 = StrOption(name='leader', doc='leader', multi=True)
|
|
||||||
option_7 = StrOption(properties=frozenset({'normal'}), name='follower1', doc='follower1', multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})))
|
|
||||||
option_8 = StrOption(properties=frozenset({'normal'}), name='follower2', doc='follower2', multi=True, default=Calculation(func.calc_val, Params((ParamOption(option_7, notraisepropertyerror=False, todict=False)), kwargs={})))
|
|
||||||
option_9 = StrOption(properties=frozenset({'normal'}), name='follower3', doc='follower3', multi=True)
|
|
||||||
option_5 = Leadership(name='leadership', doc='leadership', properties=frozenset({'normal'}), children=[option_6, option_7, option_8, option_9])
|
|
||||||
option_4 = OptionDescription(name='general1', doc='general1', properties=frozenset({'normal'}), children=[option_5])
|
|
||||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2, option_4])
|
|
||||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1])
|
|
|
@ -14,6 +14,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<value>c</value>
|
<value>c</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
<family name="enumfam" mode="expert">
|
<family name="enumfam" mode="expert">
|
||||||
<variable name="enumvar" type="string" description="multi" mandatory="True"/>
|
<variable name="enumvar" type="string" description="multi" mandatory="True"/>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<value>b</value>
|
<value>b</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<family name="enumfam" mode="expert">
|
<family name="enumfam" mode="expert">
|
||||||
<variable name="enumvar" type="string" description="multi" help="bla bla bla"/>
|
<variable name="enumvar" type="string" description="multi" help="bla bla bla"/>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<family name="enumfam" mode="expert">
|
<family name="enumfam" mode="expert">
|
||||||
<variable name="enumvar" type="string" description="multi" help="bla bla bla"/>
|
<variable name="enumvar" type="string" description="multi" help="bla bla bla"/>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True"/>
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True"/>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<value>oui</value>
|
<value>oui</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
|
|
@ -12,4 +12,6 @@
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
</variables>
|
</variables>
|
||||||
|
<constraints>
|
||||||
|
</constraints>
|
||||||
</rougail>
|
</rougail>
|
||||||
|
|
|
@ -14,5 +14,6 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
|
|
||||||
<rougail>
|
|
||||||
<variables>
|
|
||||||
<family name='ejabberd'>
|
|
||||||
<variable name="description" type="string">
|
|
||||||
<value>Exportation de la base de ejabberd</value>
|
|
||||||
</variable>
|
|
||||||
<variable name="day" type="schedule"></variable>
|
|
||||||
<variable name="mode" type="schedulemod">
|
|
||||||
<value>pre</value>
|
|
||||||
</variable>
|
|
||||||
</family>
|
|
||||||
</variables>
|
|
||||||
</rougail>
|
|
|
@ -1 +0,0 @@
|
||||||
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "rougail.general.module_instancie": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": "none", "extra.ejabberd.mode": "pre"}
|
|
|
@ -1,21 +0,0 @@
|
||||||
from importlib.machinery import SourceFileLoader
|
|
||||||
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
|
||||||
for key, value in dict(locals()).items():
|
|
||||||
if key != ['SourceFileLoader', 'func']:
|
|
||||||
setattr(func, key, value)
|
|
||||||
try:
|
|
||||||
from tiramisu3 import *
|
|
||||||
except:
|
|
||||||
from tiramisu import *
|
|
||||||
from rougail.tiramisu import ConvertDynOptionDescription
|
|
||||||
option_5 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='module_instancie', doc='No change', multi=False, default='non')
|
|
||||||
option_3 = StrOption(properties=frozenset({'auto_freeze', 'basic', 'force_store_value', 'mandatory', Calculation(calc_value, Params(ParamValue('auto_frozen'), kwargs={'condition': ParamOption(option_5, todict=True), 'expected': ParamValue('oui'), 'reverse_condition': ParamValue(True)}))}), name='mode_conteneur_actif', doc='No change', multi=False, default='non')
|
|
||||||
option_4 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='activer_ejabberd', doc='No change', multi=False, default='non')
|
|
||||||
option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'basic'}), children=[option_3, option_4, option_5])
|
|
||||||
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
|
||||||
option_8 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='description', doc='description', multi=False, default='Exportation de la base de ejabberd')
|
|
||||||
option_9 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='day', doc='day', multi=False, default='none', values=('none', 'daily', 'weekly', 'monthly'))
|
|
||||||
option_10 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode', doc='mode', multi=False, default='pre', values=('pre', 'post'))
|
|
||||||
option_7 = OptionDescription(name='ejabberd', doc='ejabberd', properties=frozenset({'normal'}), children=[option_8, option_9, option_10])
|
|
||||||
option_6 = OptionDescription(name='extra', doc='extra', children=[option_7])
|
|
||||||
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_6])
|
|
|
@ -2,15 +2,12 @@
|
||||||
<rougail>
|
<rougail>
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="général">
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change" auto_freeze="True">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
<variable name="activer_ejabberd" type="string" description="No change" hidden="True">
|
<variable name="activer_ejabberd" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
<variable name="module_instancie" type="string" description="No change" hidden="True">
|
|
||||||
<value>non</value>
|
|
||||||
</variable>
|
|
||||||
</family>
|
</family>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
|
@ -0,0 +1,26 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<rougail>
|
||||||
|
<variables>
|
||||||
|
<family name='ejabberd'>
|
||||||
|
<variable name="description" type="string">
|
||||||
|
<value>Exportation de la base de ejabberd</value>
|
||||||
|
</variable>
|
||||||
|
<variable name="day" type="schedule"></variable>
|
||||||
|
<variable name="mode" type="schedulemod">
|
||||||
|
<value>pre</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
<separators>
|
||||||
|
<separator name="extra.ejabberd.day">Séparateur</separator>
|
||||||
|
</separators>
|
||||||
|
</variables>
|
||||||
|
<constraints>
|
||||||
|
<fill name='calc_multi_condition' target='extra.ejabberd.day'>
|
||||||
|
<param>non</param>
|
||||||
|
<param type='variable' name='condition_1' notraisepropertyerror='True'>activer_ejabberd</param>
|
||||||
|
<param name='match'>none</param>
|
||||||
|
<param name='mismatch'>daily</param>
|
||||||
|
</fill>
|
||||||
|
</constraints>
|
||||||
|
</rougail>
|
|
@ -0,0 +1 @@
|
||||||
|
{"rougail.general.mode_conteneur_actif": "non", "rougail.general.activer_ejabberd": "non", "extra.ejabberd.description": "Exportation de la base de ejabberd", "extra.ejabberd.day": null, "extra.ejabberd.mode": "pre"}
|
|
@ -0,0 +1,21 @@
|
||||||
|
from importlib.machinery import SourceFileLoader
|
||||||
|
func = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py').load_module()
|
||||||
|
for key, value in dict(locals()).items():
|
||||||
|
if key != ['SourceFileLoader', 'func']:
|
||||||
|
setattr(func, key, value)
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
from rougail.tiramisu import ConvertDynOptionDescription
|
||||||
|
option_3 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='mode_conteneur_actif', doc='No change', multi=False, default='non')
|
||||||
|
option_4 = StrOption(properties=frozenset({'force_default_on_freeze', 'frozen', 'hidden', 'mandatory', 'normal'}), name='activer_ejabberd', doc='No change', multi=False, default='non')
|
||||||
|
option_2 = OptionDescription(name='general', doc='général', properties=frozenset({'normal'}), children=[option_3, option_4])
|
||||||
|
option_1 = OptionDescription(name='rougail', doc='rougail', children=[option_2])
|
||||||
|
option_7 = StrOption(properties=frozenset({'mandatory', 'normal'}), name='description', doc='description', multi=False, default='Exportation de la base de ejabberd')
|
||||||
|
option_8 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='day', doc='day', multi=False, default=Calculation(func.calc_multi_condition, Params((ParamValue("non")), kwargs={'condition_1': ParamOption(option_4, notraisepropertyerror=True, todict=False), 'match': ParamValue("none"), 'mismatch': ParamValue("daily")})), values=('none', 'daily', 'weekly', 'monthly'))
|
||||||
|
option_8.impl_set_information("separator", "Séparateur")
|
||||||
|
option_9 = ChoiceOption(properties=frozenset({'mandatory', 'normal'}), name='mode', doc='mode', multi=False, default='pre', values=('pre', 'post'))
|
||||||
|
option_6 = OptionDescription(name='ejabberd', doc='ejabberd', properties=frozenset({'normal'}), children=[option_7, option_8, option_9])
|
||||||
|
option_5 = OptionDescription(name='extra', doc='extra', children=[option_6])
|
||||||
|
option_0 = OptionDescription(name='baseoption', doc='baseoption', children=[option_1, option_5])
|
|
@ -11,6 +11,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -140,6 +140,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</family>
|
</family>
|
||||||
<family doc="" name="extra">
|
<family doc="" name="extra">
|
||||||
<family hidden="False" mode="basic" doc="test" name="test">
|
<family hidden="False" mode="basic" doc="test" name="test">
|
||||||
|
|
|
@ -15,5 +15,6 @@
|
||||||
<value>/etc/mailname2</value>
|
<value>/etc/mailname2</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
|
|
|
@ -19,5 +19,6 @@
|
||||||
<value>mailname2</value>
|
<value>mailname2</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
|
|
|
@ -17,5 +17,6 @@
|
||||||
<value>mailname</value>
|
<value>mailname</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -14,5 +14,6 @@
|
||||||
<value>/etc/mailname</value>
|
<value>/etc/mailname</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
</rougail>
|
</rougail>
|
||||||
<!-- vim: ts=4 sw=4 expandtab
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
|
<value>non</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
<separators>
|
||||||
|
<separator name="mode_conteneur_actif">Établissement</separator>
|
||||||
|
<separator name="mode_conteneur_actif">Établissement</separator>
|
||||||
|
</separators>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
|
@ -0,0 +1,15 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
|
<value>non</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
<separators>
|
||||||
|
<separator name="mode_conteneur_actif">Établissement</separator>
|
||||||
|
</separators>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
<variables>
|
||||||
|
<separators>
|
||||||
|
<separator name="mode_conteneur_actif">Établissement</separator>
|
||||||
|
</separators>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
|
@ -0,0 +1,16 @@
|
||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail>
|
||||||
|
<variables>
|
||||||
|
<family name="general">
|
||||||
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
|
<value>non</value>
|
||||||
|
</variable>
|
||||||
|
</family>
|
||||||
|
<separators>
|
||||||
|
<separator name="mode_conteneur_actif">Établissement</separator>
|
||||||
|
<separator name="nonexist_variable">separator</separator>
|
||||||
|
</separators>
|
||||||
|
</variables>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
|
@ -11,6 +11,7 @@
|
||||||
<value>c</value>
|
<value>c</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<family name="enumfam" mode="expert">
|
<family name="enumfam" mode="expert">
|
||||||
<variable name="enumvar" type="number" description="enumvar"/>
|
<variable name="enumvar" type="number" description="enumvar"/>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
<separators/>
|
||||||
</variables>
|
</variables>
|
||||||
|
|
||||||
<constraints>
|
<constraints>
|
||||||
|
|
Loading…
Reference in New Issue