Bug 1287258 - retry deletions on windows; r=ted
MozReview-Commit-ID: KObLa5RsjFW
--- a/config/nsinstall.py
+++ b/config/nsinstall.py
@@ -6,16 +6,17 @@
# It's intended to be used when there's no natively compile nsinstall
# available, and doesn't intend to be fully equivalent.
# Its major use is for l10n repackaging on systems that don't have
# a full build environment set up.
# The basic limitation is, it doesn't even try to link and ignores
# all related options.
from __future__ import print_function
from optparse import OptionParser
+import mozfile
import os
import os.path
import sys
import shutil
import stat
def _nsinstall_internal(argv):
usage = "usage: %prog [options] arg1 [arg2 ...] target-directory"
@@ -121,20 +122,20 @@ def _nsinstall_internal(argv):
os.mkdir(targetpath)
entries = [os.path.join(srcpath, e) for e in os.listdir(srcpath)]
copy_all_entries(entries, targetpath)
# options.t is not relevant for directories
if options.m:
os.chmod(targetpath, options.m)
else:
if os.path.exists(targetpath):
- # On Windows, read-only files can't be deleted
if sys.platform == "win32":
- os.chmod(targetpath, stat.S_IWUSR)
- os.remove(targetpath)
+ mozfile.remove(targetpath)
+ else:
+ os.remove(targetpath)
if options.t:
shutil.copy2(srcpath, targetpath)
else:
shutil.copy(srcpath, targetpath)
# the last argument is the target directory
target = args.pop()
# ensure target directory (importantly, we do not apply a mode to the directory