Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Martin Ertsaas <martiert@gmail.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 4/5] lib/oe/path.py: Use shutil.rmtree if the path we wish to remove is a directory.
Date: Thu, 10 Jan 2013 09:50:05 +0100	[thread overview]
Message-ID: <1357807806-31720-4-git-send-email-martiert@gmail.com> (raw)
In-Reply-To: <1357807806-31720-1-git-send-email-martiert@gmail.com>

On mac, os.unlink can not be done to remove directories, and so we have to
explicitly use shutil.rmtree instead to support mac.
---
 meta/lib/oe/path.py |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py
index 7197b23..1da39b7 100644
--- a/meta/lib/oe/path.py
+++ b/meta/lib/oe/path.py
@@ -86,14 +86,7 @@ def copytree(src, dst):
 
 def remove(path, recurse=True):
     """Equivalent to rm -f or rm -rf"""
-    for name in glob.glob(path):
-        try:
-            os.unlink(name)
-        except OSError, exc:
-            if recurse and exc.errno == errno.EISDIR:
-                shutil.rmtree(name)
-            elif exc.errno != errno.ENOENT:
-                raise
+    bb.utils.remove(path, recurse)
 
 def symlink(source, destination, force=False):
     """Create a symbolic link"""
-- 
1.7.10.2 (Apple Git-33)




  parent reply	other threads:[~2013-01-10  9:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-10  8:50 [PATCH 1/5] sanity: Make the required utilities more platform specific Martin Ertsaas
2013-01-10  8:50 ` [PATCH 2/5] quilt: Remove non-gnu.patch, and added configure flags for darwin Martin Ertsaas
2013-01-10  8:50 ` [PATCH 3/5] quilt: Don't use BUILD_ROOT on darwin Martin Ertsaas
2013-01-10  8:50 ` Martin Ertsaas [this message]
2013-01-10 14:15   ` [PATCH 4/5] lib/oe/path.py: Use shutil.rmtree if the path we wish to remove is a directory Chris Larson
2013-01-11  6:27     ` Martin Ertsaas
2013-01-11 14:55       ` Chris Larson
2013-01-10  8:50 ` [PATCH 5/5] sstate: Do not add the --no-run-if-empty arguement to xargs when on Darwin, as it is not supported Martin Ertsaas
2013-01-15  8:14 ` [PATCH 1/5] sanity: Make the required utilities more platform specific Richard Purdie
2013-01-15  9:07   ` Martin Ertsaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1357807806-31720-4-git-send-email-martiert@gmail.com \
    --to=martiert@gmail.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox