[oe-commits] Enrico Scholz : oe.path: added 'recurse' argument to remove()

git version control git at git.openembedded.org
Mon Sep 27 23:50:39 UTC 2010


Module: openembedded.git
Branch: master
Commit: eb30ef6d8ef030ed9c1ba581798204eb4e1c313b
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=eb30ef6d8ef030ed9c1ba581798204eb4e1c313b

Author: Enrico Scholz <enrico.scholz at sigma-chemnitz.de>
Date:   Mon Aug 16 00:52:42 2010 +0000

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 at sigma-chemnitz.de>
Acked-by: Chris Larson <chris_larson at mentor.com>
Signed-off-by: Khem Raj <raj.khem at gmail.com>

---

 lib/oe/path.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/oe/path.py b/lib/oe/path.py
index f58c013..3d64cfa 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





More information about the Openembedded-commits mailing list