aboutsummaryrefslogtreecommitdiffstats
path: root/lib/oe
diff options
context:
space:
mode:
authorEnrico Scholz <enrico.scholz@sigma-chemnitz.de>2010-08-16 00:52:42 +0000
committerKhem Raj <raj.khem@gmail.com>2010-09-27 16:49:52 -0700
commiteb30ef6d8ef030ed9c1ba581798204eb4e1c313b (patch)
tree0e216e4e44c3c77348cfa928fb1db03e8b7c8938 /lib/oe
parented5388f2fcb72718e4b8afd872f92c9dc047a0fe (diff)
downloadopenembedded-eb30ef6d8ef030ed9c1ba581798204eb4e1c313b.tar.gz
openembedded-eb30ef6d8ef030ed9c1ba581798204eb4e1c313b.tar.bz2
openembedded-eb30ef6d8ef030ed9c1ba581798204eb4e1c313b.zip
oe.path: added 'recurse' argument to remove()
This makes it possible to specify whether the equivalent of 'rm -rf' or only this of 'rm -f' is wanted. Due to backward compatibility it defaults to the recursive variant. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Acked-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'lib/oe')
-rw-r--r--lib/oe/path.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/oe/path.py b/lib/oe/path.py
index f58c0138bb..3d64cfaac1 100644
--- a/lib/oe/path.py
+++ b/lib/oe/path.py
@@ -43,13 +43,13 @@ def format_display(path, metadata):
else:
return rel
-def remove(path):
+def remove(path, recurse=True):
"""Equivalent to rm -f or rm -rf"""
import os, errno, shutil
try:
os.unlink(path)
except OSError, exc:
- if exc.errno == errno.EISDIR:
+ if recurse and exc.errno == errno.EISDIR:
shutil.rmtree(path)
elif exc.errno != errno.ENOENT:
raise