summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorBrian Dolbec <brian.dolbec@gmail.com>2011-01-31 16:12:40 -0800
committerZac Medico <zmedico@gentoo.org>2011-01-31 16:17:42 -0800
commit1989cc809b67b8f847d58c096fb70fe89a961a3e (patch)
tree0ff24ebf93c22cd59021fd61be8d9ef7fe72e731 /pym
parent394cd4a00d37fd078f8dd40f89f8c810355d7816 (diff)
downloadportage-1989cc809b67b8f847d58c096fb70fe89a961a3e.tar.gz
portage-1989cc809b67b8f847d58c096fb70fe89a961a3e.tar.bz2
portage-1989cc809b67b8f847d58c096fb70fe89a961a3e.zip
put main code in a private func() to remove near duplicated code
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/package/ebuild/_config/MaskManager.py43
1 files changed, 29 insertions, 14 deletions
diff --git a/pym/portage/package/ebuild/_config/MaskManager.py b/pym/portage/package/ebuild/_config/MaskManager.py
index be7a21274..c438eb7da 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] = tuple(v)
- def getMaskAtom(self, cpv, slot, repo):
+ def _getMaskAtom(self, cpv, slot, repo, unmask_atoms=None):
"""
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 = "".join((pkg, _repo_separator, repo))
pkg_list = [pkg]
- unmask_atoms = 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
+
+ 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 = 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.
"""
- cp = cpv_getkey(cpv)
- mask_atoms = self._pmaskdict_raw.get(cp)
- if mask_atoms:
- pkg = "".join((cpv, _slot_separator, slot))
- if repo:
- pkg = "".join((pkg, _repo_separator, repo))
- pkg_list = [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)