From 28184c982a0688ed9bc4d82df407d4e400f6318c Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 22 Jun 2009 05:07:45 +0000 Subject: [PATCH] Use portage.util.apply_permissions() inside _ensure_access(). svn path=/main/trunk/; revision=13662 --- pym/portage/cache/fs_template.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pym/portage/cache/fs_template.py b/pym/portage/cache/fs_template.py index ee8964e70..d41749186 100644 --- a/pym/portage/cache/fs_template.py +++ b/pym/portage/cache/fs_template.py @@ -5,7 +5,14 @@ import os from portage.cache import template -from portage.data import portage_gid + +import portage.proxy.lazyimport +import portage.proxy as proxy +proxy.lazyimport.lazyimport(globals(), + 'portage.data:portage_gid', + 'portage.exception:PortageException', + 'portage.util:apply_permissions', +) class FsBased(template.database): """template wrapping fs needed options, and providing _ensure_access as a way to @@ -34,14 +41,11 @@ class FsBased(template.database): """returns true or false if it's able to ensure that path is properly chmod'd and chowned. if mtime is specified, attempts to ensure that's correct also""" try: - if self._gid != -1: - os.chown(path, -1, self._gid) - if self._perms != -1: - os.chmod(path, self._perms) + apply_permissions(path, gid=self._gid, mode=self._perms) if mtime != -1: mtime=long(mtime) os.utime(path, (mtime, mtime)) - except (OSError, IOError): + except (PortageException, EnvironmentError): return False return True -- 2.26.2