]> code.ossystems Code Review - openembedded-core.git/commitdiff
bitbake/utils.py: add glob name matching to remove
authorSaul Wold <sgw@linux.intel.com>
Tue, 8 Feb 2011 17:24:12 +0000 (09:24 -0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 8 Feb 2011 17:35:49 +0000 (17:35 +0000)
Signed-off-by: Saul Wold <sgw@linux.intel.com>
bitbake/lib/bb/utils.py

index a8da672b51b2d6c3d08dcbf243a43ee1ecf46377..6373912d884e96ed8ed2dacb0e6ca53687b37179 100644 (file)
@@ -594,14 +594,15 @@ def remove(path, recurse=False):
     """Equivalent to rm -f or rm -rf"""
     if not path:
         return
-    import os, errno, shutil
-    try:
-        os.unlink(path)
-    except OSError as exc:
-        if recurse and exc.errno == errno.EISDIR:
-            shutil.rmtree(path)
-        elif exc.errno != errno.ENOENT:
-            raise
+    import os, errno, shutil, glob
+    for name in glob.glob(path):
+        try:
+            os.unlink(name)
+        except OSError as exc:
+            if recurse and exc.errno == errno.EISDIR:
+                shutil.rmtree(name)
+            elif exc.errno != errno.ENOENT:
+                raise
 
 def prunedir(topdir):
     # Delete everything reachable from the directory named in 'topdir'.