From patchwork Thu Jan 10 08:50:05 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4/5] lib/oe/path.py: Use shutil.rmtree if the path we wish to remove is a directory. Date: Thu, 10 Jan 2013 08:50:05 -0000 From: Martin Ertsaas X-Patchwork-Id: 42437 Message-Id: <1357807806-31720-4-git-send-email-martiert@gmail.com> To: openembedded-core@lists.openembedded.org 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"""