From: Joshua Lock Date: Thu, 5 Aug 2010 11:57:25 +0000 (+0100) Subject: lib/oe: support wildcards in path.remove X-Git-Tag: 2011-1~4954 X-Git-Url: https://code.ossystems.io/gitweb?a=commitdiff_plain;h=a5884df90d628b2dc13ac83c9d8045afa6b2a120;p=openembedded-core.git lib/oe: support wildcards in path.remove Signed-off-by: Joshua Lock --- diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py index f58c0138bb..183f205757 100644 --- a/meta/lib/oe/path.py +++ b/meta/lib/oe/path.py @@ -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"""