| Submitter | Martin Ertsaas |
|---|---|
| Date | Jan. 10, 2013, 8:50 a.m. |
| Message ID | <1357807806-31720-4-git-send-email-martiert@gmail.com> |
| Download | mbox | patch |
| Permalink | /patch/42437/ |
| State | New |
| Headers | show |
Comments
On Thu, Jan 10, 2013 at 1:50 AM, Martin Ertsaas <martiert@gmail.com> wrote: > On mac, os.unlink can not be done to remove directories, and so we have to > explicitly use shutil.rmtree instead to support mac. > As pointed out for the bitbake patch, the functions can already handle this case if you pass recurse=True, and mac isn't at all special in this context.
On 01/10/13 15:15, Chris Larson wrote: > > On Thu, Jan 10, 2013 at 1:50 AM, Martin Ertsaas <martiert@gmail.com > <mailto:martiert@gmail.com>> wrote: > > On mac, os.unlink can not be done to remove directories, and so we > have to > explicitly use shutil.rmtree instead to support mac. > > > As pointed out for the bitbake patch, the functions can already handle > this case if you pass recurse=True, and mac isn't at all special in > this context. > -- > Christopher Larson True. In this case though, I feel the patch is still valid though, and that I should instead change the commit message. What I want from this patch, as I see it again now, is to not duplicate the same code in both bitbake and oe-core, when the oe-core function 'remove' can just be calling bb.utils.remove. So personally I still want this patch, I just wish to change the commit message to something sane. Agreed? - Martin
On Thu, Jan 10, 2013 at 11:27 PM, Martin Ertsaas <martiert@gmail.com> wrote: > On 01/10/13 15:15, Chris Larson wrote: > > > On Thu, Jan 10, 2013 at 1:50 AM, Martin Ertsaas <martiert@gmail.com>wrote: > >> On mac, os.unlink can not be done to remove directories, and so we have to >> explicitly use shutil.rmtree instead to support mac. >> > > As pointed out for the bitbake patch, the functions can already handle > this case if you pass recurse=True, and mac isn't at all special in this > context. > -- > Christopher Larson > > True. In this case though, I feel the patch is still valid though, and > that I should instead change the commit message. What I want from this > patch, as I see it again now, is to not duplicate the same code in both > bitbake and oe-core, when the oe-core function 'remove' can just be calling > bb.utils.remove. So personally I still want this patch, I just wish to > change the commit message to something sane. Agreed? > Agreed.
Patch
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"""