MCPcopy
hub / github.com/deadc0de6/dotdrop / _descend

Method _descend

dotdrop/uninstaller.py:75–97  ·  view source on GitHub ↗
(self, dirpath)

Source from the content-addressed store, hash-verified

73 return ret, msg
74
75 def _descend(self, dirpath):
76 ret = True
77 self.log.dbg(f'recursively uninstall {dirpath}')
78 for sub in os.listdir(dirpath):
79 subpath = os.path.join(dirpath, sub)
80 if os.path.isdir(subpath):
81 self.log.dbg(f'under {dirpath} uninstall dir {subpath}')
82 self._descend(subpath)
83 else:
84 self.log.dbg(f'under {dirpath} uninstall file {subpath}')
85 subret, _ = self._remove(subpath)
86 if not subret:
87 ret = False
88
89 if dir_empty(dirpath):
90 # empty
91 self.log.dbg(f'remove empty dir {dirpath}')
92 if self.dry:
93 self.log.dry(f'would \"rm -r {dirpath}\"')
94 return True, ''
95 return self._remove_path(dirpath)
96 self.log.dbg(f'not removing non-empty dir {dirpath}')
97 return ret, ''
98
99 def _remove_path(self, path):
100 """remove a file"""

Callers 1

_removeMethod · 0.95

Calls 5

_removeMethod · 0.95
_remove_pathMethod · 0.95
dir_emptyFunction · 0.90
dbgMethod · 0.80
dryMethod · 0.80

Tested by

no test coverage detected