From de0657223812d7768e6b474d6db84d87fa2242ff Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 6 Jun 2011 03:29:48 -0700 Subject: [PATCH] getmaskingreason: assume myrepo arg is valid --- pym/portage/package/ebuild/getmaskingreason.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pym/portage/package/ebuild/getmaskingreason.py b/pym/portage/package/ebuild/getmaskingreason.py index 4e3833d03..c19066f61 100644 --- a/pym/portage/package/ebuild/getmaskingreason.py +++ b/pym/portage/package/ebuild/getmaskingreason.py @@ -16,6 +16,12 @@ from _emerge.Package import Package def getmaskingreason(mycpv, metadata=None, settings=None, portdb=None, return_location=False, myrepo=None): + """ + If specified, the myrepo argument is assumed it be valid. This + should be a safe assumption since portdbapi methods always + return valid repo names and valid "repository" metadata from + aux_get. + """ if settings is None: settings = portage.settings if portdb is None: @@ -24,9 +30,6 @@ def getmaskingreason(mycpv, metadata=None, settings=None, if not mysplit: raise ValueError(_("invalid CPV: %s") % mycpv) - if myrepo: - myrepo = _gen_valid_repo(myrepo) - if metadata is None: db_keys = list(portdb._aux_cache_keys) try: @@ -36,10 +39,10 @@ def getmaskingreason(mycpv, metadata=None, settings=None, if not portdb.cpv_exists(mycpv): raise else: - if not myrepo: + if myrepo is None: myrepo = _gen_valid_repo(metadata["repository"]) - elif not myrepo: + elif myrepo is None: myrepo = metadata.get("repository") if myrepo is not None: myrepo = _gen_valid_repo(metadata["repository"]) -- 2.26.2