diff options
author | Joshua Lock <josh@linux.intel.com> | 2010-08-05 12:57:25 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-08-12 14:41:31 +0100 |
commit | a5884df90d628b2dc13ac83c9d8045afa6b2a120 (patch) | |
tree | 2edb2464e403438446ed88e38a4415105c1a0f58 /meta/lib | |
parent | dfd7e1f76b30219f3fe30dfe60fcfc6daf6daf9e (diff) | |
download | poky-a5884df90d628b2dc13ac83c9d8045afa6b2a120.tar.gz |
lib/oe: support wildcards in path.remove
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Diffstat (limited to 'meta/lib')
-rw-r--r-- | meta/lib/oe/path.py | 17 |
1 files changed, 9 insertions, 8 deletions
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): | |||
45 | 45 | ||
46 | def remove(path): | 46 | def remove(path): |
47 | """Equivalent to rm -f or rm -rf""" | 47 | """Equivalent to rm -f or rm -rf""" |
48 | import os, errno, shutil | 48 | import os, errno, shutil, glob |
49 | try: | 49 | for name in glob.glob(path): |
50 | os.unlink(path) | 50 | try: |
51 | except OSError, exc: | 51 | os.unlink(name) |
52 | if exc.errno == errno.EISDIR: | 52 | except OSError, exc: |
53 | shutil.rmtree(path) | 53 | if exc.errno == errno.EISDIR: |
54 | elif exc.errno != errno.ENOENT: | 54 | shutil.rmtree(path) |
55 | raise | 55 | elif exc.errno != errno.ENOENT: |
56 | raise | ||
56 | 57 | ||
57 | def symlink(source, destination, force=False): | 58 | def symlink(source, destination, force=False): |
58 | """Create a symbolic link""" | 59 | """Create a symbolic link""" |