| 178 | pass |
| 179 | |
| 180 | def release(self): |
| 181 | if not self.is_locked(): |
| 182 | raise NotLocked(str(self.path)) |
| 183 | if not self.by_me(): |
| 184 | raise NotMyLock(str(self.path)) |
| 185 | self.unique_name.unlink() |
| 186 | for retry in range(42): |
| 187 | try: |
| 188 | self.path.rmdir() |
| 189 | except OSError as err: |
| 190 | if err.errno in (errno.EACCES,): |
| 191 | # windows behaving strangely? -> just try again. |
| 192 | continue |
| 193 | if err.errno not in (errno.ENOTEMPTY, errno.EEXIST, errno.ENOENT): |
| 194 | # EACCES or EIO or ... = we cannot operate anyway, so re-throw |
| 195 | raise err |
| 196 | # else: |
| 197 | # Directory is not empty or doesn't exist any more. |
| 198 | # this means we lost the race to somebody else -- which is ok. |
| 199 | return |
| 200 | |
| 201 | def is_locked(self): |
| 202 | return self.path.exists() |