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 1RBXcC-000207-1N for garchives@archives.gentoo.org; Wed, 05 Oct 2011 19:58:52 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8720F21C27A; Wed, 5 Oct 2011 19:58:39 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 51FD521C27A for ; Wed, 5 Oct 2011 19:58:39 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id C366C1B4040 for ; Wed, 5 Oct 2011 19:58:38 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id C0AB980042 for ; Wed, 5 Oct 2011 19:58:37 +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: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: fcc8105402dc5f0b55aacff0368a5977e271ec3d Date: Wed, 5 Oct 2011 19:58:37 +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: 7628df5941b7cff60222382dd1f7879c commit: fcc8105402dc5f0b55aacff0368a5977e271ec3d Author: Zac Medico gentoo org> AuthorDate: Wed Oct 5 19:51:05 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Wed Oct 5 19:51:05 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dfcc81054 match_to_list: preserve order This allows us to properly test behavior of best_match_to_list with different permutations of the input. --- pym/portage/dep/__init__.py | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py index 8c65d66..154b8a2 100644 --- a/pym/portage/dep/__init__.py +++ b/pym/portage/dep/__init__.py @@ -1776,7 +1776,14 @@ def match_to_list(mypkg, mylist): @rtype: List @return: A unique list of package atoms that match the given package at= om """ - return [ x for x in set(mylist) if match_from_list(x, [mypkg]) ] + matches =3D set() + result =3D [] + pkgs =3D [mypkg] + for x in mylist: + if x not in matches and match_from_list(x, pkgs): + matches.add(x) + result.append(x) + return result =20 def best_match_to_list(mypkg, mylist): """