You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
1.1 KiB

from calculate.templates.template_engine import TemplateEngine, DIR, Variables
from calculate.templates.template_processor import TemplateAction
main = Variables({'cl_template_path':
('tests/templates/testfiles/template_dir_1,'
'tests/templates/testfiles/template_dir_2'),
'cl_chroot_path': '/'})
datavars = Variables({'main': main})
try:
template_engine = TemplateEngine(
datavars_module=datavars,
appends_set=TemplateAction().available_appends)
template_engine.process_template_from_string(
("{% calculate package = 'dev-lang/python-3.6', action = 'install',"
"chmod = 'rwxr-xr-x', append = 'join', force %}"),
DIR)
template_engine.parameters.print_parameters_for_debug()
template_engine.process_template_from_string(
"{% calculate package = 'dev-lang/python-2.7', action = 'update' %}",
DIR)
template_engine.parameters.print_parameters_for_debug()
except Exception as error:
print(str(error))