mirror of
https://github.com/deadc0de6/dotdrop.git
synced 2026-02-04 16:49:42 +00:00
code quality
This commit is contained in:
@@ -669,13 +669,15 @@ class CfgYaml:
|
||||
err = 'bad format for chmod: {}'.format(val)
|
||||
self._log.err(err)
|
||||
raise YamlException('config content error: {}'.format(err))
|
||||
# normalize chmod value
|
||||
for x in list(val):
|
||||
y = int(x)
|
||||
if y >= 0 or y <= 7:
|
||||
continue
|
||||
err = 'bad format for chmod: {}'.format(val)
|
||||
self._log.err(err)
|
||||
raise YamlException('config content error: {}'.format(err))
|
||||
if y < 0 or y > 7:
|
||||
err = 'bad format for chmod: {}'.format(val)
|
||||
self._log.err(err)
|
||||
raise YamlException(
|
||||
'config content error: {}'.format(err)
|
||||
)
|
||||
v[self.key_dotfile_chmod] = int(val, 8)
|
||||
|
||||
return new
|
||||
@@ -1028,7 +1030,6 @@ class CfgYaml:
|
||||
if not yamldict[self.key_dotfiles]:
|
||||
return
|
||||
for k, dotfile in yamldict[self.key_dotfiles].items():
|
||||
new = self.lnk_nolink
|
||||
if self.key_dotfile_link in dotfile and \
|
||||
type(dotfile[self.key_dotfile_link]) is bool:
|
||||
# patch link: <bool>
|
||||
|
||||
@@ -64,8 +64,8 @@ class Dotfile(DictParser):
|
||||
msg = '[{}] transformations disabled'.format(key)
|
||||
msg += ' because dotfile is linked'
|
||||
self.log.warn(msg)
|
||||
trans_r = []
|
||||
trans_w = []
|
||||
self.trans_r = []
|
||||
self.trans_w = []
|
||||
|
||||
def get_dotfile_variables(self):
|
||||
"""return this dotfile specific variables"""
|
||||
|
||||
@@ -563,9 +563,6 @@ class Installer:
|
||||
err = 'broken symlink {}'.format(dst)
|
||||
return False, err
|
||||
|
||||
src_mode = chmod
|
||||
if not src_mode:
|
||||
src_mode = utils.get_file_perm(src)
|
||||
if self.diff:
|
||||
if not self._is_different(src, dst, content=content):
|
||||
if self.debug:
|
||||
|
||||
@@ -58,6 +58,4 @@ def main():
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if main():
|
||||
sys.exit(0)
|
||||
sys.exit(1)
|
||||
main():
|
||||
|
||||
Reference in New Issue
Block a user