summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-12-11 23:12:45 +0000
committerZac Medico <zmedico@gentoo.org>2007-12-11 23:12:45 +0000
commitd19cc80ef4bf8b6d6ec7b89b75f2a7a77dfab94c (patch)
tree6ebfdb8bd7d7c06ea52c22a60b31e1e37fdc8ecc /pym
parentecefd74bdbe0ca305e05e35d9ed673738420e9f0 (diff)
downloadportage-d19cc80ef4bf8b6d6ec7b89b75f2a7a77dfab94c.tar.gz
portage-d19cc80ef4bf8b6d6ec7b89b75f2a7a77dfab94c.tar.bz2
portage-d19cc80ef4bf8b6d6ec7b89b75f2a7a77dfab94c.zip
* Raise PermissionDenied from getconfig() when appropriate.
* When available, make getconfig() include an invalid token in a ParseError message. svn path=/main/trunk/; revision=8883
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/util.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/pym/portage/util.py b/pym/portage/util.py
index 1e3b9cc30..fa816d728 100644
--- a/pym/portage/util.py
+++ b/pym/portage/util.py
@@ -308,6 +308,8 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
try:
f=open(mycfg,'r')
except IOError, e:
+ if e.errno == PermissionDenied.errno:
+ raise PermissionDenied(mycfg)
if e.errno != errno.ENOENT:
raise
return None
@@ -338,9 +340,9 @@ def getconfig(mycfg, tolerant=0, allow_sourcing=False, expand=True):
#invalid token
#lex.error_leader(self.filename,lex.lineno)
if not tolerant:
- writemsg("!!! Invalid token (not \"=\") "+str(equ)+"\n",
- noiselevel=-1)
- raise Exception("ParseError: Invalid token (not '='): "+str(mycfg)+": line "+str(lex.lineno))
+ raise Exception("ParseError: Invalid token " + \
+ "'%s' (not '='): %s: line %s" % \
+ (equ, mycfg, lex.lineno))
else:
return mykeys
val=lex.get_token()