From a65a85b3731de18e7215304791325675d4a263ca Mon Sep 17 00:00:00 2001 From: Claudius Heine Date: Wed, 21 Jun 2017 13:32:59 +0200 Subject: [PATCH] Added file header section and put 'includes' under it. In the current configuration file we mix between entries that are file specific (like includes and later version) and entries that are used by the rest of kas, that are not file specific (machine, target, repos, etc.) It might not be obvious to differenciate between those entries. This patch introduces a header section into the configuration file, to contain every setting that is specific to the file and not the complete kas configuration. The 'includes' statement is moved there, because its file specific. Signed-off-by: Claudius Heine --- kas/includehandler.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/kas/includehandler.py b/kas/includehandler.py index 18b3a72..32b119e 100644 --- a/kas/includehandler.py +++ b/kas/includehandler.py @@ -109,14 +109,15 @@ class GlobalIncludes(IncludeHandler): topfile.yml: ------- - includes: - - include1.yml - - file: include2.yml - - repo: repo1 - file: include-repo1.yml - - repo: repo2 - file: include-repo2.yml - - include3.yml + header: + includes: + - include1.yml + - file: include2.yml + - repo: repo1 + file: include-repo1.yml + - repo: repo2 + file: include-repo2.yml + - include3.yml ------- Includes are merged in in this order: @@ -132,7 +133,9 @@ class GlobalIncludes(IncludeHandler): if not isinstance(current_config, collections.Mapping): raise IncludeException('Configuration file does not contain a ' 'dictionary as base type') - for include in current_config.get('includes', []): + header = current_config.get('header', {}) + + for include in header.get('includes', []): if isinstance(include, str): includefile = '' if include.startswith(os.path.pathsep):