diff options
author | Saul Wold <sgw@linux.intel.com> | 2011-02-08 09:24:12 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-08 17:35:49 +0000 |
commit | 07088f7711e0b53c4fac3685d15d406cf4793602 (patch) | |
tree | 11f3cc19387dee2793e03b8cbf5dfbde47eabc67 /bitbake | |
parent | aa45760702e874977454778659c205b29d1ff049 (diff) | |
download | poky-07088f7711e0b53c4fac3685d15d406cf4793602.tar.gz |
bitbake/utils.py: add glob name matching to remove
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/utils.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index a8da672b51..6373912d88 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -594,14 +594,15 @@ def remove(path, recurse=False): | |||
594 | """Equivalent to rm -f or rm -rf""" | 594 | """Equivalent to rm -f or rm -rf""" |
595 | if not path: | 595 | if not path: |
596 | return | 596 | return |
597 | import os, errno, shutil | 597 | import os, errno, shutil, glob |
598 | try: | 598 | for name in glob.glob(path): |
599 | os.unlink(path) | 599 | try: |
600 | except OSError as exc: | 600 | os.unlink(name) |
601 | if recurse and exc.errno == errno.EISDIR: | 601 | except OSError as exc: |
602 | shutil.rmtree(path) | 602 | if recurse and exc.errno == errno.EISDIR: |
603 | elif exc.errno != errno.ENOENT: | 603 | shutil.rmtree(name) |
604 | raise | 604 | elif exc.errno != errno.ENOENT: |
605 | raise | ||
605 | 606 | ||
606 | def prunedir(topdir): | 607 | def prunedir(topdir): |
607 | # Delete everything reachable from the directory named in 'topdir'. | 608 | # Delete everything reachable from the directory named in 'topdir'. |