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 1Pm4UV-0007u8-0y for garchives@archives.gentoo.org; Sun, 06 Feb 2011 13:17:23 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 14012E0BA6; Sun, 6 Feb 2011 13:10:05 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id C589DE0BA6 for ; Sun, 6 Feb 2011 13:09:59 +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 6BD9C1B41E0 for ; Sun, 6 Feb 2011 13:09:59 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id D8C668005E for ; Sun, 6 Feb 2011 13:09:58 +0000 (UTC) From: "Thomas Sachau" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Thomas Sachau" Message-ID: <1989cc809b67b8f847d58c096fb70fe89a961a3e.tommy@gentoo> Subject: [gentoo-commits] proj/portage:multilib commit in: pym/portage/package/ebuild/_config/ X-VCS-Repository: proj/portage X-VCS-Files: pym/portage/package/ebuild/_config/MaskManager.py X-VCS-Directories: pym/portage/package/ebuild/_config/ X-VCS-Committer: tommy X-VCS-Committer-Name: Thomas Sachau X-VCS-Revision: 1989cc809b67b8f847d58c096fb70fe89a961a3e Date: Sun, 6 Feb 2011 13:09:58 +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: baf9767cecc32a50aface8f21fcde16d commit: 1989cc809b67b8f847d58c096fb70fe89a961a3e Author: Brian Dolbec gmail com> AuthorDate: Tue Feb 1 00:12:40 2011 +0000 Commit: Thomas Sachau gentoo org> CommitDate: Tue Feb 1 00:17:42 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3D1989cc80 put main code in a private func() to remove near duplicated code --- pym/portage/package/ebuild/_config/MaskManager.py | 43 ++++++++++++++-= ------ 1 files changed, 29 insertions(+), 14 deletions(-) diff --git a/pym/portage/package/ebuild/_config/MaskManager.py b/pym/port= age/package/ebuild/_config/MaskManager.py index be7a212..c438eb7 100644 --- a/pym/portage/package/ebuild/_config/MaskManager.py +++ b/pym/portage/package/ebuild/_config/MaskManager.py @@ -112,7 +112,7 @@ class MaskManager(object): for k, v in d.items(): d[k] =3D tuple(v) =20 - def getMaskAtom(self, cpv, slot, repo): + def _getMaskAtom(self, cpv, slot, repo, unmask_atoms=3DNone): """ Take a package and return a matching package.mask atom, or None if no such atom exists or it has been cancelled by package.unmask. PROVIDE @@ -122,6 +122,10 @@ class MaskManager(object): @type cpv: String @param slot: The package's slot @type slot: String + @param repo: The package's repository [optional] + @type repo: String + @param unmask_atoms: if desired pass in self._punmaskdict.get(cp) + @type unmask_atoms: list @rtype: String @return: A matching atom string or None if one is not found. """ @@ -133,7 +137,6 @@ class MaskManager(object): if repo: pkg =3D "".join((pkg, _repo_separator, repo)) pkg_list =3D [pkg] - unmask_atoms =3D self._punmaskdict.get(cp) for x in mask_atoms: if not match_from_list(x, pkg_list): continue @@ -144,6 +147,27 @@ class MaskManager(object): return x return None =20 + + def getMaskAtom(self, cpv, slot, repo): + """ + Take a package and return a matching package.mask atom, or None if no + such atom exists or it has been cancelled by package.unmask. PROVIDE + is not checked, so atoms will not be found for old-style virtuals. + + @param cpv: The package name + @type cpv: String + @param slot: The package's slot + @type slot: String + @param repo: The package's repository [optional] + @type repo: String + @rtype: String + @return: A matching atom string or None if one is not found. + """ + + cp =3D cpv_getkey(cpv) + return self._getMaskAtom(cpv, slot, repo, self._punmaskdict.get(cp)) + + def getRawMaskAtom(self, cpv, slot, repo): """ Take a package and return a matching package.mask atom, or None if no @@ -155,19 +179,10 @@ class MaskManager(object): @type cpv: String @param slot: The package's slot @type slot: String + @param repo: The package's repository [optional] + @type repo: String @rtype: String @return: A matching atom string or None if one is not found. """ =20 - cp =3D cpv_getkey(cpv) - mask_atoms =3D self._pmaskdict_raw.get(cp) - if mask_atoms: - pkg =3D "".join((cpv, _slot_separator, slot)) - if repo: - pkg =3D "".join((pkg, _repo_separator, repo)) - pkg_list =3D [pkg] - for x in mask_atoms: - if not match_from_list(x, pkg_list): - continue - return x - return None + return self._getMaskAtom(cpv, slot, repo)