summaryrefslogtreecommitdiffstats
path: root/source-builder/sb/path.py
diff options
context:
space:
mode:
Diffstat (limited to 'source-builder/sb/path.py')
-rw-r--r--source-builder/sb/path.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/source-builder/sb/path.py b/source-builder/sb/path.py
index 20ab73c..67aeacd 100644
--- a/source-builder/sb/path.py
+++ b/source-builder/sb/path.py
@@ -127,7 +127,14 @@ def mkdir(path):
def removeall(path):
def _onerror(function, path, excinfo):
- print 'removeall error: (%s) %s' % (excinfo, path)
+ import stat
+ if not os.access(path, os.W_OK):
+ # Is the error an access error ?
+ os.chmod(path, stat.S_IWUSR)
+ function(path)
+ else:
+ print 'removeall error: %s' % (path)
+ raise
path = host(path)
shutil.rmtree(path, onerror = _onerror)