]> code.ossystems Code Review - openembedded-core.git/commitdiff
lib/oe: support wildcards in path.remove
authorJoshua Lock <josh@linux.intel.com>
Thu, 5 Aug 2010 11:57:25 +0000 (12:57 +0100)
committerRichard Purdie <rpurdie@linux.intel.com>
Thu, 12 Aug 2010 13:41:31 +0000 (14:41 +0100)
Signed-off-by: Joshua Lock <josh@linux.intel.com>
meta/lib/oe/path.py

index f58c0138bb41d602c6511ffe848e6aa74f91d32c..183f205757f310fd0a7fd34e86155f4cd42495fe 100644 (file)
@@ -45,14 +45,15 @@ def format_display(path, metadata):
 
 def remove(path):
     """Equivalent to rm -f or rm -rf"""
-    import os, errno, shutil
-    try:
-        os.unlink(path)
-    except OSError, exc:
-        if 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, exc:
+            if exc.errno == errno.EISDIR:
+                shutil.rmtree(path)
+            elif exc.errno != errno.ENOENT:
+                raise
 
 def symlink(source, destination, force=False):
     """Create a symbolic link"""