diff options
author | Zac Medico <zmedico@gentoo.org> | 2012-10-17 18:56:18 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2012-10-17 18:56:18 -0700 |
commit | 9846cad27ac880271804e8065997024364b74906 (patch) | |
tree | 66ff1b571ae20c78f70076ba48147ab1bc18f497 /pym/portage | |
parent | 4ec3c49862c9b3cf0ccd7bd2d8112faf36bb04f0 (diff) | |
download | portage-9846cad27ac880271804e8065997024364b74906.tar.gz portage-9846cad27ac880271804e8065997024364b74906.tar.bz2 portage-9846cad27ac880271804e8065997024364b74906.zip |
getmaskingreason: use _pkg_str
Diffstat (limited to 'pym/portage')
-rw-r--r-- | pym/portage/package/ebuild/getmaskingreason.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/pym/portage/package/ebuild/getmaskingreason.py b/pym/portage/package/ebuild/getmaskingreason.py index 8a88c2f60..20b76c44a 100644 --- a/pym/portage/package/ebuild/getmaskingreason.py +++ b/pym/portage/package/ebuild/getmaskingreason.py @@ -1,4 +1,4 @@ -# Copyright 2010-2011 Gentoo Foundation +# Copyright 2010-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 __all__ = ['getmaskingreason'] @@ -6,13 +6,12 @@ __all__ = ['getmaskingreason'] import portage from portage import os from portage.const import USER_CONFIG_PATH -from portage.dep import Atom, match_from_list, _slot_separator, _repo_separator +from portage.dep import Atom, match_from_list from portage.exception import InvalidAtom from portage.localization import _ from portage.repository.config import _gen_valid_repo from portage.util import grablines, normalize_path -from portage.versions import catpkgsplit -from _emerge.Package import Package +from portage.versions import catpkgsplit, _pkg_str def getmaskingreason(mycpv, metadata=None, settings=None, portdb=None, return_location=False, myrepo=None): @@ -60,15 +59,14 @@ def getmaskingreason(mycpv, metadata=None, settings=None, # Sometimes we can't access SLOT or repository due to corruption. pkg = mycpv - if metadata is not None: - pkg = "".join((mycpv, _slot_separator, metadata["SLOT"])) - # At this point myrepo should be None, a valid name, or - # Package.UNKNOWN_REPO which we ignore. - if myrepo is not None and myrepo != Package.UNKNOWN_REPO: - pkg = "".join((pkg, _repo_separator, myrepo)) + try: + pkg.slot + except AttributeError: + pkg = _pkg_str(mycpv, metadata=metadata, repo=myrepo) + cpv_slot_list = [pkg] - mycp=mysplit[0]+"/"+mysplit[1] + mycp = pkg.cp # XXX- This is a temporary duplicate of code from the config constructor. locations = [os.path.join(settings["PORTDIR"], "profiles")] |