summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2015-03-07 09:19:21 +1100
committerChris Johns <chrisj@rtems.org>2015-03-07 09:24:51 +1100
commit88cb50a3a411d4e3c6122e6cc60d8533db700cb1 (patch)
tree04950614d3076aa7d181607ad40d75c0d6c49f50
parentUpdate the documentation path. (diff)
downloadrtems-source-builder-88cb50a3a411d4e3c6122e6cc60d8533db700cb1.tar.bz2
Fix removall for Windows and POSIX file systems.
-rw-r--r--source-builder/sb/path.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/source-builder/sb/path.py b/source-builder/sb/path.py
index 8cf8a2c..5fa8aef 100644
--- a/source-builder/sb/path.py
+++ b/source-builder/sb/path.py
@@ -143,17 +143,23 @@ def removeall(path):
for root, dirs, files in os.walk(path, topdown = False):
for name in files:
file = host(os.path.join(root, name))
- if not os.access(file, os.W_OK):
+ if not os.path.islink(file) and not os.access(file, os.W_OK):
os.chmod(file, stat.S_IWUSR)
os.unlink(file)
for name in dirs:
dir = host(os.path.join(root, name))
- if not os.access(dir, os.W_OK):
- os.chmod(dir, stat.S_IWUSR)
- os.rmdir(dir)
- if not os.access(path, os.W_OK):
+ if os.path.islink(dir):
+ os.unlink(dir)
+ else:
+ if not os.access(dir, os.W_OK):
+ os.chmod(dir, stat.S_IWUSR)
+ os.rmdir(dir)
+ if not os.path.islink(path) and not os.access(path, os.W_OK):
os.chmod(path, stat.S_IWUSR)
- os.rmdir(path)
+ if os.path.islink(path):
+ os.unlink(path)
+ else:
+ os.rmdir(path)
def expand(name, paths):
l = []