remove path
(self, path)
| 106 | return True, '' |
| 107 | |
| 108 | def _remove(self, path): |
| 109 | """remove path""" |
| 110 | self.log.dbg(f'handling uninstall of {path}') |
| 111 | if path.endswith(self.backup_suffix): |
| 112 | self.log.dbg(f'skip {path} ignored') |
| 113 | return True, '' |
| 114 | backup = f'{path}{self.backup_suffix}' |
| 115 | if os.path.exists(backup): |
| 116 | self.log.dbg(f'backup exists for {path}: {backup}') |
| 117 | return self._replace(path, backup) |
| 118 | self.log.dbg(f'no backup file for {path}') |
| 119 | |
| 120 | if os.path.isdir(path): |
| 121 | self.log.dbg(f'{path} is a directory') |
| 122 | return self._descend(path) |
| 123 | |
| 124 | if self.dry: |
| 125 | self.log.dry(f'would \"rm {path}\"') |
| 126 | return True, '' |
| 127 | |
| 128 | msg = f'Remove {path}?' |
| 129 | if self.safe and not self.log.ask(msg): |
| 130 | return False, 'user refused' |
| 131 | self.log.dbg(f'removing {path}') |
| 132 | return self._remove_path(path) |
| 133 | |
| 134 | def _replace(self, path, backup): |
| 135 | """replace path by backup""" |