aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-06-08 16:14:37 -0700
committerChris Larson <chris_larson@mentor.com>2010-06-10 11:35:00 -0700
commit2959eb8c60df3b7ea1833238f9eac05cdafe1c06 (patch)
tree094419d7ff16216256b043c52b7413394cc96acd /lib
parent50d20ac55d111d2c0d25c3dba76a02b8d936a9c9 (diff)
downloadopenembedded-2959eb8c60df3b7ea1833238f9eac05cdafe1c06.tar.gz
Add a rm -rf utility function and use it in packaged-staging.bbclass
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/oe/path.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/oe/path.py b/lib/oe/path.py
index 8902951581..a145456659 100644
--- a/lib/oe/path.py
+++ b/lib/oe/path.py
@@ -42,3 +42,14 @@ def format_display(path, metadata):
return path
else:
return rel
+
+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