diff options
author | Richard Purdie <richard@openedhand.com> | 2008-08-18 07:56:04 +0000 |
---|---|---|
committer | Richard Purdie <richard@openedhand.com> | 2008-08-18 07:56:04 +0000 |
commit | 5ca566349c46362be64fc6a88ed88ad3ad601069 (patch) | |
tree | 4377347a371d7dd47bcb2940657d838f1f9b6ee9 /bitbake/lib/bb/utils.py | |
parent | 77c01014e02e3e0a9879673352010c67cba206ea (diff) | |
download | poky-5ca566349c46362be64fc6a88ed88ad3ad601069.tar.gz |
bitbake/utils.py: Add prunedir function to utils collection
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@5065 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r-- | bitbake/lib/bb/utils.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 19327b7157..ec46021b55 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -268,3 +268,13 @@ def sha256_file(filename): | |||
268 | for line in open(filename): | 268 | for line in open(filename): |
269 | s.update(line) | 269 | s.update(line) |
270 | return s.hexdigest() | 270 | return s.hexdigest() |
271 | |||
272 | def prunedir(topdir): | ||
273 | # Delete everything reachable from the directory named in 'topdir'. | ||
274 | # CAUTION: This is dangerous! | ||
275 | for root, dirs, files in os.walk(topdir, topdown=False): | ||
276 | for name in files: | ||
277 | os.remove(os.path.join(root, name)) | ||
278 | for name in dirs: | ||
279 | os.rmdir(os.path.join(root, name)) | ||
280 | os.rmdir(topdir) | ||