1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-04 02:00:04 +00:00

bitbake/utils.py: add glob name matching to remove

Signed-off-by: Saul Wold <sgw@linux.intel.com>
This commit is contained in:
Saul Wold
2011-02-08 09:24:12 -08:00
committed by Richard Purdie
parent aa45760702
commit 07088f7711
+9 -8
View File
@@ -594,14 +594,15 @@ def remove(path, recurse=False):
"""Equivalent to rm -f or rm -rf"""
if not path:
return
import os, errno, shutil
try:
os.unlink(path)
except OSError as exc:
if recurse and 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 as exc:
if recurse and exc.errno == errno.EISDIR:
shutil.rmtree(name)
elif exc.errno != errno.ENOENT:
raise
def prunedir(topdir):
# Delete everything reachable from the directory named in 'topdir'.