From: Zac Medico Date: Thu, 17 Mar 2011 18:39:28 +0000 (-0700) Subject: dep_check: return errors as unicode X-Git-Tag: v2.2.0_alpha28~8 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=730b33af5ab9e2b7efd2ee4928a1d635dfefaab0;p=portage.git 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) --- 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)