lib/oe: support wildcards in path.remove
Signed-off-by: Joshua Lock <josh@linux.intel.com>
This commit is contained in:
parent
dfd7e1f76b
commit
a5884df90d
|
@ -45,14 +45,15 @@ def format_display(path, metadata):
|
||||||
|
|
||||||
def remove(path):
|
def remove(path):
|
||||||
"""Equivalent to rm -f or rm -rf"""
|
"""Equivalent to rm -f or rm -rf"""
|
||||||
import os, errno, shutil
|
import os, errno, shutil, glob
|
||||||
try:
|
for name in glob.glob(path):
|
||||||
os.unlink(path)
|
try:
|
||||||
except OSError, exc:
|
os.unlink(name)
|
||||||
if exc.errno == errno.EISDIR:
|
except OSError, exc:
|
||||||
shutil.rmtree(path)
|
if exc.errno == errno.EISDIR:
|
||||||
elif exc.errno != errno.ENOENT:
|
shutil.rmtree(path)
|
||||||
raise
|
elif exc.errno != errno.ENOENT:
|
||||||
|
raise
|
||||||
|
|
||||||
def symlink(source, destination, force=False):
|
def symlink(source, destination, force=False):
|
||||||
"""Create a symbolic link"""
|
"""Create a symbolic link"""
|
||||||
|
|
Loading…
Reference in New Issue