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 /subcmds | |
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 'subcmds')
-rw-r--r-- | subcmds/sync.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py index 93fea23b..cda47fdd 100644 --- a/subcmds/sync.py +++ b/subcmds/sync.py | |||
@@ -489,7 +489,7 @@ later is required to fix a server side protocol bug. | |||
489 | for root, dirs, files in os.walk(path): | 489 | for root, dirs, files in os.walk(path): |
490 | for f in files: | 490 | for f in files: |
491 | try: | 491 | try: |
492 | os.remove(os.path.join(root, f)) | 492 | platform_utils.remove(os.path.join(root, f)) |
493 | except OSError: | 493 | except OSError: |
494 | print('Failed to remove %s' % os.path.join(root, f), file=sys.stderr) | 494 | print('Failed to remove %s' % os.path.join(root, f), file=sys.stderr) |
495 | failed = True | 495 | failed = True |
@@ -500,7 +500,7 @@ later is required to fix a server side protocol bug. | |||
500 | for d in reversed(dirs_to_remove): | 500 | for d in reversed(dirs_to_remove): |
501 | if platform_utils.islink(d): | 501 | if platform_utils.islink(d): |
502 | try: | 502 | try: |
503 | os.remove(d) | 503 | platform_utils.remove(d) |
504 | except OSError: | 504 | except OSError: |
505 | print('Failed to remove %s' % os.path.join(root, d), file=sys.stderr) | 505 | print('Failed to remove %s' % os.path.join(root, d), file=sys.stderr) |
506 | failed = True | 506 | failed = True |
@@ -712,7 +712,7 @@ later is required to fix a server side protocol bug. | |||
712 | else: # Not smart sync or smart tag mode | 712 | else: # Not smart sync or smart tag mode |
713 | if os.path.isfile(smart_sync_manifest_path): | 713 | if os.path.isfile(smart_sync_manifest_path): |
714 | try: | 714 | try: |
715 | os.remove(smart_sync_manifest_path) | 715 | platform_utils.remove(smart_sync_manifest_path) |
716 | except OSError as e: | 716 | except OSError as e: |
717 | print('error: failed to remove existing smart sync override manifest: %s' % | 717 | print('error: failed to remove existing smart sync override manifest: %s' % |
718 | e, file=sys.stderr) | 718 | e, file=sys.stderr) |
@@ -956,7 +956,7 @@ class _FetchTimes(object): | |||
956 | f.close() | 956 | f.close() |
957 | except (IOError, ValueError): | 957 | except (IOError, ValueError): |
958 | try: | 958 | try: |
959 | os.remove(self._path) | 959 | platform_utils.remove(self._path) |
960 | except OSError: | 960 | except OSError: |
961 | pass | 961 | pass |
962 | self._times = {} | 962 | self._times = {} |
@@ -980,7 +980,7 @@ class _FetchTimes(object): | |||
980 | f.close() | 980 | f.close() |
981 | except (IOError, TypeError): | 981 | except (IOError, TypeError): |
982 | try: | 982 | try: |
983 | os.remove(self._path) | 983 | platform_utils.remove(self._path) |
984 | except OSError: | 984 | except OSError: |
985 | pass | 985 | pass |
986 | 986 | ||