diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-06-08 16:14:37 -0700 |
---|---|---|
committer | Chris Larson <chris_larson@mentor.com> | 2010-06-10 11:35:00 -0700 |
commit | 2959eb8c60df3b7ea1833238f9eac05cdafe1c06 (patch) | |
tree | 094419d7ff16216256b043c52b7413394cc96acd /lib/oe | |
parent | 50d20ac55d111d2c0d25c3dba76a02b8d936a9c9 (diff) |
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/oe')
-rw-r--r-- | lib/oe/path.py | 11 |
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 |