diff options
author | Renaud Paquay <rpaquay@google.com> | 2016-11-03 10:37:53 -0700 |
---|---|---|
committer | David Pursehouse <dpursehouse@collab.net> | 2017-05-29 19:32:31 +0900 |
commit | a65adf74f990eeac0d90011476376c7239cb7af5 (patch) | |
tree | 9278d9ce7c8d68a85dd049ed1ea5b64d84135fc0 /subcmds/init.py | |
parent | d5cec5e752821ca2710101b626b3a3ca07fdb7f8 (diff) | |
download | git-repo-a65adf74f990eeac0d90011476376c7239cb7af5.tar.gz |
Workaround shutil.rmtree limitation on Windows
By default, shutil.rmtree raises an exception when deleting readonly
files on Windows.
Replace all shutil.rmtree with platform_utils.rmtree, which adds an
error handler to make files read-write when they can't be deleted.
Change-Id: I9cfea9a7b3703fb16a82cf69331540c2c179ed53
Diffstat (limited to 'subcmds/init.py')
-rw-r--r-- | subcmds/init.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/subcmds/init.py b/subcmds/init.py index 65dfd1fd..e6470916 100644 --- a/subcmds/init.py +++ b/subcmds/init.py | |||
@@ -17,7 +17,6 @@ from __future__ import print_function | |||
17 | import os | 17 | import os |
18 | import platform | 18 | import platform |
19 | import re | 19 | import re |
20 | import shutil | ||
21 | import sys | 20 | import sys |
22 | 21 | ||
23 | from pyversion import is_python3 | 22 | from pyversion import is_python3 |
@@ -35,6 +34,7 @@ from error import ManifestParseError | |||
35 | from project import SyncBuffer | 34 | from project import SyncBuffer |
36 | from git_config import GitConfig | 35 | from git_config import GitConfig |
37 | from git_command import git_require, MIN_GIT_VERSION | 36 | from git_command import git_require, MIN_GIT_VERSION |
37 | import platform_utils | ||
38 | 38 | ||
39 | class Init(InteractiveCommand, MirrorSafeCommand): | 39 | class Init(InteractiveCommand, MirrorSafeCommand): |
40 | common = True | 40 | common = True |
@@ -252,7 +252,7 @@ to update the working directory files. | |||
252 | # Better delete the manifest git dir if we created it; otherwise next | 252 | # Better delete the manifest git dir if we created it; otherwise next |
253 | # time (when user fixes problems) we won't go through the "is_new" logic. | 253 | # time (when user fixes problems) we won't go through the "is_new" logic. |
254 | if is_new: | 254 | if is_new: |
255 | shutil.rmtree(m.gitdir) | 255 | platform_utils.rmtree(m.gitdir) |
256 | sys.exit(1) | 256 | sys.exit(1) |
257 | 257 | ||
258 | if opt.manifest_branch: | 258 | if opt.manifest_branch: |