From 61668d3fc8b2ec227ec74f1daf519602dee297b8 Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Mon, 27 Feb 2023 22:22:07 +0100 Subject: [PATCH] fix bug #380 --- dotdrop/cfg_aggregator.py | 13 +++++++++++++ dotdrop/cfg_yaml.py | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/dotdrop/cfg_aggregator.py b/dotdrop/cfg_aggregator.py index fa18a44..c1a79c4 100644 --- a/dotdrop/cfg_aggregator.py +++ b/dotdrop/cfg_aggregator.py @@ -274,37 +274,48 @@ class CfgAggregator: reloading=reloading, debug=self.debug) + self.log.dbg('parsing cfgyaml into cfg_aggregator') + # settings + self.log.dbg('parsing settings') self.settings = Settings.parse(None, self.cfgyaml.settings) self.key_prefix = self.settings.key_prefix self.key_separator = self.settings.key_separator # dotfiles + self.log.dbg('parsing dotfiles') self.dotfiles = Dotfile.parse_dict(self.cfgyaml.dotfiles) debug_list('dotfiles', self.dotfiles, self.debug) # profiles + self.log.dbg('parsing profiles') self.profiles = Profile.parse_dict(self.cfgyaml.profiles) debug_list('profiles', self.profiles, self.debug) # actions + self.log.dbg('parsing actions') self.actions = Action.parse_dict(self.cfgyaml.actions) debug_list('actions', self.actions, self.debug) # trans_r + self.log.dbg('parsing trans_r') self.trans_r = Transform.parse_dict(self.cfgyaml.trans_r) debug_list('trans_r', self.trans_r, self.debug) # trans_w + self.log.dbg('parsing trans_w') self.trans_w = Transform.parse_dict(self.cfgyaml.trans_w) debug_list('trans_w', self.trans_w, self.debug) # variables + self.log.dbg('parsing variables') self.variables = self.cfgyaml.variables debug_dict('variables', self.variables, self.debug) + self.log.dbg('enrich variables') self._enrich_variables() + self.log.dbg('patch keys...') # patch dotfiles in profiles self._patch_keys_to_objs(self.profiles, "dotfiles", self.get_dotfile) @@ -333,6 +344,8 @@ class CfgAggregator: self._get_trans_w_args(self.get_trans_w), islist=False) + self.log.dbg('done parsing cfgyaml into cfg_aggregator') + def _enrich_variables(self): """ enrich available variables diff --git a/dotdrop/cfg_yaml.py b/dotdrop/cfg_yaml.py index 8c57964..ade9add 100644 --- a/dotdrop/cfg_yaml.py +++ b/dotdrop/cfg_yaml.py @@ -256,7 +256,7 @@ class CfgYaml: # process imported variables (import_variables) newvars = self._import_variables() self._clear_profile_vars(newvars) - self._add_variables(newvars) + self._add_variables(newvars, prio=True) # process imported actions (import_actions) self._import_actions() @@ -1042,7 +1042,7 @@ class CfgYaml: if dvar.keys(): self._shell_exec_dvars(merged, keys=dvar.keys()) self._clear_profile_vars(merged) - newvars = self._merge_dict(newvars, merged) + newvars = self._merge_dict(merged, newvars) if self._debug: self._debug_dict('imported variables', newvars) return newvars