mirror of
https://github.com/Dev-Wiki/git-repo.git
synced 2025-12-13 08:04:02 +08:00
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
This commit is contained in:
@@ -42,6 +42,7 @@ else:
|
||||
|
||||
from signal import SIGTERM
|
||||
from error import GitError, UploadError
|
||||
import platform_utils
|
||||
from trace import Trace
|
||||
if is_python3():
|
||||
from http.client import HTTPException
|
||||
@@ -268,7 +269,7 @@ class GitConfig(object):
|
||||
try:
|
||||
if os.path.getmtime(self._json) \
|
||||
<= os.path.getmtime(self.file):
|
||||
os.remove(self._json)
|
||||
platform_utils.remove(self._json)
|
||||
return None
|
||||
except OSError:
|
||||
return None
|
||||
@@ -280,7 +281,7 @@ class GitConfig(object):
|
||||
finally:
|
||||
fd.close()
|
||||
except (IOError, ValueError):
|
||||
os.remove(self._json)
|
||||
platform_utils.remove(self._json)
|
||||
return None
|
||||
|
||||
def _SaveJson(self, cache):
|
||||
@@ -292,7 +293,7 @@ class GitConfig(object):
|
||||
fd.close()
|
||||
except (IOError, TypeError):
|
||||
if os.path.exists(self._json):
|
||||
os.remove(self._json)
|
||||
platform_utils.remove(self._json)
|
||||
|
||||
def _ReadGit(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user