<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jan 10, 2013 at 1:46 AM, Martin Ertsaas <span dir="ltr"><<a href="mailto:martiert@gmail.com" target="_blank">martiert@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":13o">On mac, os.unlink does not remove directories, and we therefor have<br>
to explicitly use shutil.rmtree if the path is a directory.<br>
---<br>
lib/bb/utils.py | 5 ++++-<br>
1 file changed, 4 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/lib/bb/utils.py b/lib/bb/utils.py<br>
index cef0fdd..8b6d3f5 100644<br>
--- a/lib/bb/utils.py<br>
+++ b/lib/bb/utils.py<br>
@@ -561,7 +561,10 @@ def remove(path, recurse=False):<br>
import os, errno, shutil, glob<br>
for name in glob.glob(path):<br>
try:<br>
- os.unlink(name)<br>
+ if os.path.isdir(name):<br>
+ shutil.rmtree(name)<br>
+ else:<br>
+ os.unlink(name)<br>
except OSError as exc:<br>
if recurse and exc.errno == errno.EISDIR:<br>
shutil.rmtree(name)</div></blockquote></div><br><br>Look 2 lines down, where it checks to see if the os.unlink failed due to it being a directory and runs shutil.rmtree if that's the case.<br>-- <br>
Christopher Larson</div></div>