[OE-core] [PATCH 4/5] lib/oe/path.py: Use shutil.rmtree if the path we wish to remove is a directory.

Martin Ertsaas martiert at gmail.com
Thu Jan 10 08:50:05 UTC 2013


On mac, os.unlink can not be done to remove directories, and so we have to
explicitly use shutil.rmtree instead to support mac.
---
 meta/lib/oe/path.py |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py
index 7197b23..1da39b7 100644
--- a/meta/lib/oe/path.py
+++ b/meta/lib/oe/path.py
@@ -86,14 +86,7 @@ def copytree(src, dst):
 
 def remove(path, recurse=True):
     """Equivalent to rm -f or rm -rf"""
-    for name in glob.glob(path):
-        try:
-            os.unlink(name)
-        except OSError, exc:
-            if recurse and exc.errno == errno.EISDIR:
-                shutil.rmtree(name)
-            elif exc.errno != errno.ENOENT:
-                raise
+    bb.utils.remove(path, recurse)
 
 def symlink(source, destination, force=False):
     """Create a symbolic link"""
-- 
1.7.10.2 (Apple Git-33)





More information about the Openembedded-core mailing list