1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-01 13:09:50 +00:00

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
This commit is contained in:
Richard Purdie
2008-08-18 07:56:04 +00:00
parent 77c01014e0
commit 5ca566349c
2 changed files with 12 additions and 11 deletions
+10
View File
@@ -268,3 +268,13 @@ def sha256_file(filename):
for line in open(filename):
s.update(line)
return s.hexdigest()
def prunedir(topdir):
# Delete everything reachable from the directory named in 'topdir'.
# CAUTION: This is dangerous!
for root, dirs, files in os.walk(topdir, topdown=False):
for name in files:
os.remove(os.path.join(root, name))
for name in dirs:
os.rmdir(os.path.join(root, name))
os.rmdir(topdir)