From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Q3x52-0005Qt-BP for garchives@archives.gentoo.org; Sun, 27 Mar 2011 21:01:00 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 462841C074; Sun, 27 Mar 2011 21:00:52 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 1493B1C074 for ; Sun, 27 Mar 2011 21:00:52 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 98FA41B4170 for ; Sun, 27 Mar 2011 21:00:51 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id 034CD8006A for ; Sun, 27 Mar 2011 21:00:51 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: Subject: [gentoo-commits] proj/portage:2.1.9 commit in: pym/portage/dbapi/, pym/portage/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dbapi/vartree.py pym/portage/exception.py X-VCS-Directories: pym/portage/dbapi/ pym/portage/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: c66a8136b431ec42ea02e6378ed1f6981d7ef81a Date: Sun, 27 Mar 2011 21:00:51 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: 7178a6faa24cfa1f273b424ffef0e521 commit: c66a8136b431ec42ea02e6378ed1f6981d7ef81a Author: Zac Medico gentoo org> AuthorDate: Sun Mar 27 20:55:11 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun Mar 27 20:58:10 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dc66a8136 UnsupportedAPIException: handle unicode in EAPI Normally EAPI doesn't contain unicode, but as in bug #359675, it can contain practically anything if files in /var/db/pkg are corrupt. --- pym/portage/dbapi/vartree.py | 2 +- pym/portage/exception.py | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py index ce94fa4..a9e8ede 100644 --- a/pym/portage/dbapi/vartree.py +++ b/pym/portage/dbapi/vartree.py @@ -1536,7 +1536,7 @@ class dblink(object): showMessage(_("!!! FAILED prerm: %s\n") % \ os.path.join(self.dbdir, "EAPI"), level=3Dlogging.ERROR, noiselevel=3D-1) - showMessage("%s\n" % (e,), + showMessage(_unicode_decode("%s\n") % (e,), level=3Dlogging.ERROR, noiselevel=3D-1) myebuildpath =3D None =20 diff --git a/pym/portage/exception.py b/pym/portage/exception.py index 64d0f7b..7891120 100644 --- a/pym/portage/exception.py +++ b/pym/portage/exception.py @@ -1,4 +1,4 @@ -# Copyright 1998-2004 Gentoo Foundation +# Copyright 1998-2011 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 =20 import signal @@ -150,13 +150,24 @@ class UnsupportedAPIException(PortagePackageExcepti= on): def __init__(self, cpv, eapi): self.cpv, self.eapi =3D cpv, eapi def __str__(self): + eapi =3D self.eapi + if not isinstance(eapi, basestring): + eapi =3D str(eapi) + eapi =3D eapi.lstrip("-") msg =3D _("Unable to do any operations on '%(cpv)s', since " "its EAPI is higher than this portage version's. Please upgrade" " to a portage version that supports EAPI '%(eapi)s'.") % \ - {"cpv": self.cpv, "eapi": str(self.eapi).lstrip("-")} - return msg + {"cpv": self.cpv, "eapi": eapi} + return _unicode_decode(msg, + encoding=3D_encodings['content'], errors=3D'replace') =20 + if sys.hexversion < 0x3000000: + + __unicode__ =3D __str__ =20 + def __str__(self): + return _unicode_encode(self.__unicode__(), + encoding=3D_encodings['content'], errors=3D'backslashreplace') =20 class SignatureException(PortageException): """Signature was not present in the checked file"""