diff options
Diffstat (limited to 'lib')
-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 |