From 5020321b9eb355d1a18d4daf1bf45e5dbc48344b Mon Sep 17 00:00:00 2001 From: deadc0de6 Date: Mon, 5 Oct 2020 20:30:45 +0200 Subject: [PATCH] ensure empty dst/src are allowed --- dotdrop/cfg_yaml.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/dotdrop/cfg_yaml.py b/dotdrop/cfg_yaml.py index ce514b9..11bdaad 100644 --- a/dotdrop/cfg_yaml.py +++ b/dotdrop/cfg_yaml.py @@ -1075,6 +1075,15 @@ class CfgYaml: self._dbg('templating dotfiles paths') dotfiles = self.dotfiles.copy() + # make sure no dotfiles path is None + for dotfile in dotfiles.values(): + src = dotfile[self.key_dotfile_src] + if src is None: + dotfile[self.key_dotfile_src] = '' + dst = dotfile[self.key_dotfile_dst] + if dst is None: + dotfile[self.key_dotfile_dst] = '' + # only keep dotfiles related to the selected profile pdfs = [] pro = self.profiles.get(self._profile, []) @@ -1258,11 +1267,17 @@ class CfgYaml: """recursively delete all none/empty values in a dictionary.""" new = {} for k, v in dic.items(): - if k == self.key_dotfiles and v: + if k == self.key_dotfile_src: + # allow empty dotfile src + new[k] = v + continue + if k == self.key_dotfile_dst: + # allow empty dotfile dst new[k] = v continue newv = v if isinstance(v, dict): + # recursive travers dict newv = self._clear_none(v) if not newv: # no empty dict