diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-12-11 23:44:59 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-12-11 23:44:59 +0000 |
commit | 06203883b252d39c335f5ef2118f43aa093334b8 (patch) | |
tree | 87689f0194413045a2af547c856c7be842691b3b /pym | |
parent | 0cdbeb9df98378c99cfa629b7e420de1d76a7c38 (diff) | |
download | portage-06203883b252d39c335f5ef2118f43aa093334b8.tar.gz portage-06203883b252d39c335f5ef2118f43aa093334b8.tar.bz2 portage-06203883b252d39c335f5ef2118f43aa093334b8.zip |
* Raise PermissionDenied from getconfig() when appropriate.
* When available, make getconfig() include an invalid token
in a ParseError message.
(trunk r8883)
svn path=/main/branches/2.1.2/; revision=8885
Diffstat (limited to 'pym')
-rw-r--r-- | pym/portage_util.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pym/portage_util.py b/pym/portage_util.py index 8e4a8cb44..b615108c3 100644 --- a/pym/portage_util.py +++ b/pym/portage_util.py @@ -294,6 +294,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 @@ -324,9 +326,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() |