lib/oe: support wildcards in path.remove

Signed-off-by: Joshua Lock <josh@linux.intel.com>
This commit is contained in:
Joshua Lock 2010-08-05 12:57:25 +01:00 committed by Richard Purdie
parent dfd7e1f76b
commit a5884df90d
1 changed files with 9 additions and 8 deletions

View File

@ -45,14 +45,15 @@ def format_display(path, metadata):
def remove(path):
"""Equivalent to rm -f or rm -rf"""
import os, errno, shutil
try:
os.unlink(path)
except OSError, exc:
if 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, exc:
if exc.errno == errno.EISDIR:
shutil.rmtree(path)
elif exc.errno != errno.ENOENT:
raise
def symlink(source, destination, force=False):
"""Create a symbolic link"""