From a65adf74f990eeac0d90011476376c7239cb7af5 Mon Sep 17 00:00:00 2001 From: Renaud Paquay Date: Thu, 3 Nov 2016 10:37:53 -0700 Subject: 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 --- subcmds/init.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'subcmds/init.py') 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 import os import platform import re -import shutil import sys from pyversion import is_python3 @@ -35,6 +34,7 @@ from error import ManifestParseError from project import SyncBuffer from git_config import GitConfig from git_command import git_require, MIN_GIT_VERSION +import platform_utils class Init(InteractiveCommand, MirrorSafeCommand): common = True @@ -252,7 +252,7 @@ to update the working directory files. # Better delete the manifest git dir if we created it; otherwise next # time (when user fixes problems) we won't go through the "is_new" logic. if is_new: - shutil.rmtree(m.gitdir) + platform_utils.rmtree(m.gitdir) sys.exit(1) if opt.manifest_branch: -- cgit v1.2.3-54-g00ecf