[rtems-source-builder commit] Fix removall for Windows and POSIX file systems.
Chris Johns
chrisj at rtems.org
Fri Mar 6 22:26:18 UTC 2015
Module: rtems-source-builder
Branch: master
Commit: 88cb50a3a411d4e3c6122e6cc60d8533db700cb1
Changeset: http://git.rtems.org/rtems-source-builder/commit/?id=88cb50a3a411d4e3c6122e6cc60d8533db700cb1
Author: Chris Johns <chrisj at rtems.org>
Date: Sat Mar 7 09:19:21 2015 +1100
Fix removall for Windows and POSIX file systems.
---
source-builder/sb/path.py | 18 ++++++++++++------
1 file 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 = []
More information about the vc
mailing list