1
0
mirror of https://github.com/deadc0de6/dotdrop.git synced 2026-02-07 21:29:22 +00:00

fix dotfile src/dst not expanded with ext variables (#177)

This commit is contained in:
deadc0de6
2019-07-10 13:39:02 +02:00
parent 5e3dce92a9
commit a4a831195e
2 changed files with 22 additions and 9 deletions

View File

@@ -214,11 +214,23 @@ class CfgYaml:
def _resolve_dotfile_paths(self):
"""resolve dotfile paths"""
t = Templategen(variables=self.variables)
for dotfile in self.dotfiles.values():
# src
src = dotfile[self.key_dotfile_src]
new = t.generate_string(src)
if new != src and self.debug:
self.log.dbg('dotfile: {} -> {}'.format(src, new))
src = new
src = os.path.join(self.settings[self.key_settings_dotpath], src)
dotfile[self.key_dotfile_src] = self._norm_path(src)
# dst
dst = dotfile[self.key_dotfile_dst]
new = t.generate_string(dst)
if new != dst and self.debug:
self.log.dbg('dotfile: {} -> {}'.format(dst, new))
dst = new
dotfile[self.key_dotfile_dst] = self._norm_path(dst)
def _rec_resolve_vars(self, variables):
@@ -292,15 +304,6 @@ class CfgYaml:
"""template any needed parts of the config"""
t = Templategen(variables=self.variables)
# dotfiles src/dst/actions keys
for k, v in self.dotfiles.items():
# src
src = v.get(self.key_dotfile_src)
v[self.key_dotfile_src] = t.generate_string(src)
# dst
dst = v.get(self.key_dotfile_dst)
v[self.key_dotfile_dst] = t.generate_string(dst)
# import_actions
new = []
entries = self.settings.get(self.key_import_actions, [])