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 <gentoo-commits+bounces-461836-garchives=archives.gentoo.org@lists.gentoo.org>) id 1STUkF-0000qG-Jc for garchives@archives.gentoo.org; Sun, 13 May 2012 09:05:39 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 000A2E001D; Sun, 13 May 2012 09:05:31 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id C6B5BE001D for <gentoo-commits@lists.gentoo.org>; Sun, 13 May 2012 09:05:31 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 0E58F1B4016 for <gentoo-commits@lists.gentoo.org>; Sun, 13 May 2012 09:05:31 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 03021E5429 for <gentoo-commits@lists.gentoo.org>; Sun, 13 May 2012 09:05:29 +0000 (UTC) From: "Zac Medico" <zmedico@gentoo.org> To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" <zmedico@gentoo.org> Message-ID: <1336899914.1564b9b0f549256fe0b8e552ae7bedd10754d61e.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/versions.py X-VCS-Directories: pym/portage/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 1564b9b0f549256fe0b8e552ae7bedd10754d61e X-VCS-Branch: master Date: Sun, 13 May 2012 09:05:29 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: b68121e8-802e-414f-aaab-9c573a3c9762 X-Archives-Hash: 8275a35ae698e533a74197eaffef3b0c commit: 1564b9b0f549256fe0b8e552ae7bedd10754d61e Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Sun May 13 09:05:14 2012 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Sun May 13 09:05:14 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D1564b9b0 Use _pkg_str.version more. --- pym/portage/versions.py | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-) diff --git a/pym/portage/versions.py b/pym/portage/versions.py index f9fb606..85928a8 100644 --- a/pym/portage/versions.py +++ b/pym/portage/versions.py @@ -393,6 +393,10 @@ def cpv_getkey(mycpv, eapi=3DNone): =20 def cpv_getversion(mycpv, eapi=3DNone): """Returns the v (including revision) from an cpv.""" + try: + return mycpv.version + except AttributeError: + pass cp =3D cpv_getkey(mycpv, eapi=3Deapi) if cp is None: return None @@ -446,10 +450,16 @@ def best(mymatches, eapi=3DNone): if len(mymatches) =3D=3D 1: return mymatches[0] bestmatch =3D mymatches[0] - p2 =3D catpkgsplit(bestmatch, eapi=3Deapi)[1:] + try: + v2 =3D bestmatch.version + except AttributeError: + v2 =3D _pkg_str(bestmatch, eapi=3Deapi).version for x in mymatches[1:]: - p1 =3D catpkgsplit(x, eapi=3Deapi)[1:] - if pkgcmp(p1, p2) > 0: + try: + v1 =3D x.version + except AttributeError: + v1 =3D _pkg_str(x, eapi=3Deapi).version + if vercmp(v1, v2) > 0: bestmatch =3D x - p2 =3D catpkgsplit(bestmatch, eapi=3Deapi)[1:] + v2 =3D v1 return bestmatch