summaryrefslogtreecommitdiffstats
path: root/pym/portage.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-09-26 04:49:11 +0000
committerZac Medico <zmedico@gentoo.org>2007-09-26 04:49:11 +0000
commite9156c77ede4e00eafd2171c8e89f2f0898cc77e (patch)
tree04bc23555aafdca7f2ea176f0ceea5994eaa82b3 /pym/portage.py
parent2aec000c6ac2b236bdd9dba00d3a001d7fdcea7b (diff)
downloadportage-e9156c77ede4e00eafd2171c8e89f2f0898cc77e.tar.gz
portage-e9156c77ede4e00eafd2171c8e89f2f0898cc77e.tar.bz2
portage-e9156c77ede4e00eafd2171c8e89f2f0898cc77e.zip
Bug #192341 - Eliminate the dependency on py-freebsd by implementing
it's chflags() and lchflags() functions as wrappers around the chflags command (which should always be available in any case). The functions are only called when merging/unmerging files that actually have flags set so the performance difference should be negligible. (trunk r7808) svn path=/main/branches/2.1.2/; revision=7833
Diffstat (limited to 'pym/portage.py')
-rw-r--r--pym/portage.py19
1 files changed, 16 insertions, 3 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 39ecb0dab..c7766e7c0 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -44,10 +44,23 @@ except ImportError, e:
bsd_chflags = None
if os.uname()[0] in ["FreeBSD"]:
- try:
- import freebsd as bsd_chflags
- except ImportError:
+ def bsd_chflags():
pass
+ def _chflags(path, flags, opts=""):
+ cmd = "chflags %s %o '%s'" % (opts, flags, path)
+ status, output = commands.getstatusoutput(cmd)
+ retval = os.WEXITSTATUS(status)
+ if os.WIFEXITED(status) and retval == os.EX_OK:
+ return
+ e = OSError(retval, output)
+ e.errno = retval
+ e.filename = path
+ e.message = output
+ raise e
+ def _lchflags(path, flags):
+ return _chflags(path, flags, opts="-h")
+ bsd_chflags.chflags = _chflags
+ bsd_chflags.lchflags = _lchflags
try:
from cache.cache_errors import CacheError