mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-10 19:39:15 +00:00
remove ignore from templategen
This commit is contained in:
@@ -143,7 +143,6 @@ def _dotfile_compare(opts, dotfile, tmp):
|
|||||||
insttmp = None
|
insttmp = None
|
||||||
if dotfile.template and \
|
if dotfile.template and \
|
||||||
Templategen.path_is_template(src,
|
Templategen.path_is_template(src,
|
||||||
ignore=ignores,
|
|
||||||
debug=opts.debug):
|
debug=opts.debug):
|
||||||
# install dotfile to temporary dir for compare
|
# install dotfile to temporary dir for compare
|
||||||
ret, err, insttmp = inst.install_to_temp(templ, tmp, src, dotfile.dst,
|
ret, err, insttmp = inst.install_to_temp(templ, tmp, src, dotfile.dst,
|
||||||
@@ -220,7 +219,6 @@ def _dotfile_install(opts, dotfile, tmpdir=None):
|
|||||||
|
|
||||||
is_template = dotfile.template and Templategen.path_is_template(
|
is_template = dotfile.template and Templategen.path_is_template(
|
||||||
dotfile.src,
|
dotfile.src,
|
||||||
ignore=ignores,
|
|
||||||
)
|
)
|
||||||
if hasattr(dotfile, 'link') and dotfile.link in (
|
if hasattr(dotfile, 'link') and dotfile.link in (
|
||||||
LinkTypes.LINK, LinkTypes.LINK_CHILDREN,
|
LinkTypes.LINK, LinkTypes.LINK_CHILDREN,
|
||||||
@@ -244,10 +242,7 @@ def _dotfile_install(opts, dotfile, tmpdir=None):
|
|||||||
return False, dotfile.key, None
|
return False, dotfile.key, None
|
||||||
src = tmp
|
src = tmp
|
||||||
# make sure to re-evaluate if is template
|
# make sure to re-evaluate if is template
|
||||||
is_template = dotfile.template and Templategen.path_is_template(
|
is_template = dotfile.template and Templategen.path_is_template(src)
|
||||||
src,
|
|
||||||
ignore=ignores,
|
|
||||||
)
|
|
||||||
ret, err = inst.install(templ, src, dotfile.dst,
|
ret, err = inst.install(templ, src, dotfile.dst,
|
||||||
LinkTypes.NOLINK,
|
LinkTypes.NOLINK,
|
||||||
actionexec=pre_actions_exec,
|
actionexec=pre_actions_exec,
|
||||||
|
|||||||
@@ -264,7 +264,7 @@ class Templategen:
|
|||||||
return data.decode('utf-8', 'replace')
|
return data.decode('utf-8', 'replace')
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def path_is_template(path, ignore=None, debug=False):
|
def path_is_template(path, debug=False):
|
||||||
"""recursively check if any file is a template within path"""
|
"""recursively check if any file is a template within path"""
|
||||||
if debug:
|
if debug:
|
||||||
LOG.dbg(f'is template: {path}', force=True)
|
LOG.dbg(f'is template: {path}', force=True)
|
||||||
@@ -274,13 +274,9 @@ class Templategen:
|
|||||||
# does not exist
|
# does not exist
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if utils.must_ignore([path], ignore, debug=debug):
|
|
||||||
# must be ignored
|
|
||||||
return False
|
|
||||||
|
|
||||||
if os.path.isfile(path):
|
if os.path.isfile(path):
|
||||||
# is file
|
# is file
|
||||||
return Templategen._is_template(path, ignore=ignore, debug=debug)
|
return Templategen._is_template(path, debug=debug)
|
||||||
|
|
||||||
# is a directory
|
# is a directory
|
||||||
for entry in os.listdir(path):
|
for entry in os.listdir(path):
|
||||||
@@ -288,13 +284,11 @@ class Templategen:
|
|||||||
if not os.path.isfile(fpath):
|
if not os.path.isfile(fpath):
|
||||||
# recursively explore directory
|
# recursively explore directory
|
||||||
if Templategen.path_is_template(fpath,
|
if Templategen.path_is_template(fpath,
|
||||||
ignore=ignore,
|
|
||||||
debug=debug):
|
debug=debug):
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
# check if file is a template
|
# check if file is a template
|
||||||
if Templategen._is_template(fpath,
|
if Templategen._is_template(fpath,
|
||||||
ignore=ignore,
|
|
||||||
debug=debug):
|
debug=debug):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
@@ -327,10 +321,10 @@ class Templategen:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _is_template(path, ignore, debug=False):
|
def _is_template(path, debug=False):
|
||||||
"""test if file pointed by path is a template"""
|
"""test if file pointed by path is a template"""
|
||||||
if utils.must_ignore([path], ignore, debug=debug):
|
if debug:
|
||||||
return False
|
Logger().dbg(f'is template: {path}')
|
||||||
if not os.path.isfile(path):
|
if not os.path.isfile(path):
|
||||||
return False
|
return False
|
||||||
if os.stat(path).st_size == 0:
|
if os.stat(path).st_size == 0:
|
||||||
|
|||||||
@@ -169,9 +169,8 @@ class Updater:
|
|||||||
return None
|
return None
|
||||||
return tmp
|
return tmp
|
||||||
|
|
||||||
def _is_template(self, path, ignores):
|
def _is_template(self, path):
|
||||||
if not Templategen.path_is_template(path,
|
if not Templategen.path_is_template(path,
|
||||||
ignore=ignores,
|
|
||||||
debug=self.debug):
|
debug=self.debug):
|
||||||
self.log.dbg(f'{path} is NO template')
|
self.log.dbg(f'{path} is NO template')
|
||||||
return False
|
return False
|
||||||
@@ -222,7 +221,7 @@ class Updater:
|
|||||||
self.log.sub(f'\"{local_path}\" ignored')
|
self.log.sub(f'\"{local_path}\" ignored')
|
||||||
return True
|
return True
|
||||||
self.log.dbg(f'update for file {deployed_path} and {local_path}')
|
self.log.dbg(f'update for file {deployed_path} and {local_path}')
|
||||||
if self._is_template(local_path, ignores):
|
if self._is_template(local_path):
|
||||||
# dotfile is a template
|
# dotfile is a template
|
||||||
self.log.dbg(f'{local_path} is a template')
|
self.log.dbg(f'{local_path} is a template')
|
||||||
if self.showpatch:
|
if self.showpatch:
|
||||||
|
|||||||
Reference in New Issue
Block a user