From 4323d334abb9b3d1424b223d8804060bfe002034 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B2=D0=B0=D0=BD=D0=BE=D0=B2=20=D0=94=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=81?= Date: Fri, 13 Nov 2020 17:11:39 +0300 Subject: [PATCH] 'skip' value of the 'append' parameter is available for template files now. --- calculate/templates/template_processor.py | 20 +++++++++---------- .../test_runner/install/dir_3/file_0 | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/calculate/templates/template_processor.py b/calculate/templates/template_processor.py index 67f9c50..1689283 100644 --- a/calculate/templates/template_processor.py +++ b/calculate/templates/template_processor.py @@ -594,6 +594,7 @@ class TemplateWrapper: def add_to_contents(self, file_md5=None) -> None: '''Метод для добавления целевого файла в CONTENTS.''' + print("add to contents") if self.target_package is None: return @@ -1103,13 +1104,11 @@ class TemplateExecutor: self.calculate_config_file.remove_file( template_object.target_path) - # Обновляем CONTENTS. - if template_object.protected: - if template_object.parameters.unbound: - template_object.remove_from_contents() - else: - template_object.add_to_contents( - file_md5=output_text_md5) + if template_object.parameters.unbound: + template_object.remove_from_contents() + else: + template_object.add_to_contents( + file_md5=output_text_md5) else: if template_object.target_type is not None and not replace: if (not input_path.startswith(self.cl_config_archive_path) or @@ -2391,11 +2390,12 @@ class DirectoryProcessor: if (not template_parameters.append and not template_parameters.run and - not template_parameters.exec): + not template_parameters.exec): template_parameters.set_parameter({'append': 'join'}) - # Выполняем действия, указанные в шаблоне. - target_file_path = self._execute_template( + if template_parameters.append != 'skip': + # Выполняем действия, указанные в шаблоне. + target_file_path = self._execute_template( target_file_path, template_parameters, FILE, template_path, diff --git a/tests/templates/testfiles/test_runner/install/dir_3/file_0 b/tests/templates/testfiles/test_runner/install/dir_3/file_0 index 00a9f5d..4b6f3c3 100644 --- a/tests/templates/testfiles/test_runner/install/dir_3/file_0 +++ b/tests/templates/testfiles/test_runner/install/dir_3/file_0 @@ -1 +1 @@ -{% calculate merge = 'app-editors/vim' -%} +{% calculate append = "skip", merge = 'app-editors/vim' -%}