-# Copyright 1999-2009 Gentoo Foundation
+# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+import sys
+
from portage.output import teal
from portage import os
+from portage import _encodings, _unicode_encode
class RepoDisplay(object):
def __init__(self, roots):
" indicates that the source repository could not be determined\n")
return "".join(output)
+ if sys.hexversion < 0x3000000:
+
+ __unicode__ = __str__
+
+ def __str__(self):
+ return _unicode_encode(self.__unicode__(),
+ encoding=_encodings['content'])
import portage
from portage import os
-from portage import digraph
+from portage import _unicode_decode
from portage.const import PORTAGE_PACKAGE_ATOM
from portage.dbapi import dbapi
from portage.dbapi.dep_expand import dep_expand
from portage._sets.base import InternalPackageSet
from portage.util import cmp_sort_key, writemsg, writemsg_stdout
from portage.util import writemsg_level
+from portage.util.digraph import digraph
from _emerge.AtomArg import AtomArg
from _emerge.Blocker import Blocker
if verbosity == 3:
writemsg_stdout('\n%s\n' % (counters,), noiselevel=-1)
if show_repos:
- # In python-2.x, str() can trigger a UnicodeEncodeError here,
- # so call __str__() directly.
- writemsg_stdout(repo_display.__str__(), noiselevel=-1)
+ # Use _unicode_decode() to force unicode format string so
+ # that RepoDisplay.__unicode__() is called in python2.
+ writemsg_stdout(_unicode_decode("%s") % (repo_display,),
+ noiselevel=-1)
if "--changelog" in self._frozen_config.myopts:
writemsg_stdout('\n', noiselevel=-1)