diff options
| author | Renaud Paquay <rpaquay@google.com> | 2016-11-11 14:25:29 -0800 |
|---|---|---|
| committer | Renaud Paquay <rpaquay@google.com> | 2017-08-31 13:49:36 -0700 |
| commit | 010fed771183c23c0e7d04a4e7292782f68de9db (patch) | |
| tree | 438b928fa1adaa7105d88462299513ca59c47c9f /git_config.py | |
| parent | e8595e9df7980b0b7d9111de43d294c4439d474c (diff) | |
| download | git-repo-010fed771183c23c0e7d04a4e7292782f68de9db.tar.gz | |
Replace all os.remove calls
os.remove raises an exception when deleting read-only files on
Windows. Replace all calls with calls to platform_utils.remove,
which deals with deals with that issue.
Change-Id: I4dc9e0c9a36b4238880520c69f5075eca40f3e66
Diffstat (limited to 'git_config.py')
| -rw-r--r-- | git_config.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/git_config.py b/git_config.py index 9d5874a2..3ba9dbd1 100644 --- a/git_config.py +++ b/git_config.py | |||
| @@ -42,6 +42,7 @@ else: | |||
| 42 | 42 | ||
| 43 | from signal import SIGTERM | 43 | from signal import SIGTERM |
| 44 | from error import GitError, UploadError | 44 | from error import GitError, UploadError |
| 45 | import platform_utils | ||
| 45 | from trace import Trace | 46 | from trace import Trace |
| 46 | if is_python3(): | 47 | if is_python3(): |
| 47 | from http.client import HTTPException | 48 | from http.client import HTTPException |
| @@ -268,7 +269,7 @@ class GitConfig(object): | |||
| 268 | try: | 269 | try: |
| 269 | if os.path.getmtime(self._json) \ | 270 | if os.path.getmtime(self._json) \ |
| 270 | <= os.path.getmtime(self.file): | 271 | <= os.path.getmtime(self.file): |
| 271 | os.remove(self._json) | 272 | platform_utils.remove(self._json) |
| 272 | return None | 273 | return None |
| 273 | except OSError: | 274 | except OSError: |
| 274 | return None | 275 | return None |
| @@ -280,7 +281,7 @@ class GitConfig(object): | |||
| 280 | finally: | 281 | finally: |
| 281 | fd.close() | 282 | fd.close() |
| 282 | except (IOError, ValueError): | 283 | except (IOError, ValueError): |
| 283 | os.remove(self._json) | 284 | platform_utils.remove(self._json) |
| 284 | return None | 285 | return None |
| 285 | 286 | ||
| 286 | def _SaveJson(self, cache): | 287 | def _SaveJson(self, cache): |
| @@ -292,7 +293,7 @@ class GitConfig(object): | |||
| 292 | fd.close() | 293 | fd.close() |
| 293 | except (IOError, TypeError): | 294 | except (IOError, TypeError): |
| 294 | if os.path.exists(self._json): | 295 | if os.path.exists(self._json): |
| 295 | os.remove(self._json) | 296 | platform_utils.remove(self._json) |
| 296 | 297 | ||
| 297 | def _ReadGit(self): | 298 | def _ReadGit(self): |
| 298 | """ | 299 | """ |
