diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-03-17 11:39:28 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-03-17 11:39:28 -0700 |
commit | 730b33af5ab9e2b7efd2ee4928a1d635dfefaab0 (patch) | |
tree | 3f078677fc557be86b0376bbfebd8fb8e40bd9e1 | |
parent | 363a7478a100495d2e8597bc6c6d2fdac94339e0 (diff) | |
download | portage-730b33af5ab9e2b7efd2ee4928a1d635dfefaab0.tar.gz portage-730b33af5ab9e2b7efd2ee4928a1d635dfefaab0.tar.bz2 portage-730b33af5ab9e2b7efd2ee4928a1d635dfefaab0.zip |
dep_check: return errors as unicode
This should prevent the following error due to returning raw bytes,
reported in forum thread #869281:
File "pym/_emerge/BlockerDB.py", line 72, in findInstalledBlockers
portage.writemsg("!!! %s/*DEPEND: %s\n" % \
(pkg_location, atoms), noiselevel=-1)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in
position 23: ordinal not in range(128)
-rw-r--r-- | pym/portage/dep/dep_check.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pym/portage/dep/dep_check.py b/pym/portage/dep/dep_check.py index 4d26f51f4..7ec01fa52 100644 --- a/pym/portage/dep/dep_check.py +++ b/pym/portage/dep/dep_check.py @@ -6,6 +6,7 @@ __all__ = ['dep_check', 'dep_eval', 'dep_wordreduce', 'dep_zapdeps'] import logging import portage +from portage import _unicode_decode from portage.dep import Atom, match_from_list, use_reduce from portage.exception import InvalidDependString, ParseError from portage.localization import _ @@ -173,8 +174,8 @@ def _expand_new_virtuals(mysplit, edebug, mydbapi, mysettings, myroot="/", del mytrees["virt_parent"] if not mycheck[0]: - raise ParseError( - "%s: %s '%s'" % (pkg, mycheck[1], depstring)) + raise ParseError(_unicode_decode("%s: %s '%s'") % \ + (pkg, mycheck[1], depstring)) # pull in the new-style virtual mycheck[1].append(virt_atom) @@ -587,7 +588,7 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None, matchall=(use=="all"), excludeall=useforce, opconvert=True, \ token_class=Atom, eapi=eapi) except InvalidDependString as e: - return [0, str(e)] + return [0, _unicode_decode("%s") % (e,)] if mysplit == []: #dependencies were reduced to nothing @@ -601,7 +602,7 @@ def dep_check(depstring, mydbapi, mysettings, use="yes", mode=None, myuse=None, use_force=useforce, use_mask=mymasks, use_cache=use_cache, use_binaries=use_binaries, myroot=myroot, trees=trees) except ParseError as e: - return [0, str(e)] + return [0, _unicode_decode("%s") % (e,)] mysplit2=mysplit[:] mysplit2=dep_wordreduce(mysplit2,mysettings,mydbapi,mode,use_cache=use_cache) |