From 010fed771183c23c0e7d04a4e7292782f68de9db Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Fri, 11 Nov 2016 14:25:29 -0800 Subject: 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 --- subcmds/sync.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'subcmds/sync.py') 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. for root, dirs, files in os.walk(path): for f in files: try: - os.remove(os.path.join(root, f)) + platform_utils.remove(os.path.join(root, f)) except OSError: print('Failed to remove %s' % os.path.join(root, f), file=sys.stderr) failed = True @@ -500,7 +500,7 @@ later is required to fix a server side protocol bug. for d in reversed(dirs_to_remove): if platform_utils.islink(d): try: - os.remove(d) + platform_utils.remove(d) except OSError: print('Failed to remove %s' % os.path.join(root, d), file=sys.stderr) failed = True @@ -712,7 +712,7 @@ later is required to fix a server side protocol bug. else: # Not smart sync or smart tag mode if os.path.isfile(smart_sync_manifest_path): try: - os.remove(smart_sync_manifest_path) + platform_utils.remove(smart_sync_manifest_path) except OSError as e: print('error: failed to remove existing smart sync override manifest: %s' % e, file=sys.stderr) @@ -956,7 +956,7 @@ class _FetchTimes(object): f.close() except (IOError, ValueError): try: - os.remove(self._path) + platform_utils.remove(self._path) except OSError: pass self._times = {} @@ -980,7 +980,7 @@ class _FetchTimes(object): f.close() except (IOError, TypeError): try: - os.remove(self._path) + platform_utils.remove(self._path) except OSError: pass -- cgit v1.2.3-54-g00ecf