All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] utils.py: Use shutil.rmtree if the path we wish to remove is a directory.
@ 2013-01-10  8:46 Martin Ertsaas
  2013-01-10 14:10 ` Chris Larson
  0 siblings, 1 reply; 6+ messages in thread
From: Martin Ertsaas @ 2013-01-10  8:46 UTC (permalink / raw)
  To: bitbake-devel

On mac, os.unlink does not remove directories, and we therefor have
to explicitly use shutil.rmtree if the path is a directory.
---
 lib/bb/utils.py |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index cef0fdd..8b6d3f5 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -561,7 +561,10 @@ def remove(path, recurse=False):
     import os, errno, shutil, glob
     for name in glob.glob(path):
         try:
-            os.unlink(name)
+            if os.path.isdir(name):
+                shutil.rmtree(name)
+            else:
+                os.unlink(name)
         except OSError as exc:
             if recurse and exc.errno == errno.EISDIR:
                 shutil.rmtree(name)
-- 
1.7.10.2 (Apple Git-33)




^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-01-15  9:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-10  8:46 [PATCH] utils.py: Use shutil.rmtree if the path we wish to remove is a directory Martin Ertsaas
2013-01-10 14:10 ` Chris Larson
2013-01-10 14:11   ` Chris Larson
2013-01-10 14:18     ` Chris Larson
2013-01-11  6:41       ` Martin Ertsaas
2013-01-15  9:13       ` Martin Ertsaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.