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 1STfXr-00054e-Iv for garchives@archives.gentoo.org; Sun, 13 May 2012 20:37:36 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AD02DE075F; Sun, 13 May 2012 20:37:18 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 7CA29E075F for ; Sun, 13 May 2012 20:37:18 +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 E44041B4056 for ; Sun, 13 May 2012 20:37:17 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id A5F0CE5429 for ; Sun, 13 May 2012 20:37:16 +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: <1336941419.0f8b7f25d2fc2b7e4571d2e739e80ec2538d3a3f.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/dep/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/dep/__init__.py X-VCS-Directories: pym/portage/dep/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 0f8b7f25d2fc2b7e4571d2e739e80ec2538d3a3f X-VCS-Branch: master Date: Sun, 13 May 2012 20:37:16 +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: 8eb5832a-0217-4a16-a49d-1d2a0f8217de X-Archives-Hash: 84b4a00709dd471d2464c05e189d9de6 commit: 0f8b7f25d2fc2b7e4571d2e739e80ec2538d3a3f Author: Zac Medico gentoo org> AuthorDate: Sun May 13 20:36:59 2012 +0000 Commit: Zac Medico gentoo org> CommitDate: Sun May 13 20:36:59 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D0f8b7f25 best_match_to_list: use _pkg_str --- pym/portage/dep/__init__.py | 12 +++++------- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 4ccc669..3838217 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -1886,9 +1886,10 @@ def best_match_to_list(mypkg, mylist): # For >, <, >=3D, and <=3D, the one with the version # closest to mypkg is the best match. if mypkg_cpv is None: - mypkg_cpv =3D getattr(mypkg, "cpv", None) - if mypkg_cpv is None: - mypkg_cpv =3D remove_slot(mypkg) + try: + mypkg_cpv =3D mypkg.cpv + except AttributeError: + mypkg_cpv =3D _pkg_str(remove_slot(mypkg)) if bestm.cpv =3D=3D mypkg_cpv or bestm.cpv =3D=3D x.cpv: pass elif x.cpv =3D=3D mypkg_cpv: @@ -1896,11 +1897,8 @@ def best_match_to_list(mypkg, mylist): else: # Sort the cpvs to find the one closest to mypkg_cpv cpv_list =3D [bestm.cpv, mypkg_cpv, x.cpv] - ver_map =3D {} - for cpv in cpv_list: - ver_map[cpv] =3D '-'.join(catpkgsplit(cpv)[2:]) def cmp_cpv(cpv1, cpv2): - return vercmp(ver_map[cpv1], ver_map[cpv2]) + return vercmp(cpv1.version, cpv2.version) cpv_list.sort(key=3Dcmp_sort_key(cmp_cpv)) if cpv_list[0] is mypkg_cpv or cpv_list[-1] is mypkg_cpv: if cpv_list[1] is x.cpv: