From 13729a95fe68a51a0a18194a913fee4d3c17d160 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 24 Sep 2011 12:27:39 -0700 Subject: portdbapi: split _visible from _iter_visible --- pym/portage/dbapi/porttree.py | 68 ++++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 33 deletions(-) (limited to 'pym') diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index aaa69fa7a..09677146c 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -1026,10 +1026,6 @@ class portdbapi(dbapi): """ aux_keys = list(self._aux_cache_keys) metadata = {} - local_config = self.settings.local_config - chost = self.settings.get('CHOST', '') - accept_chost = self.settings._accept_chost - getMaskAtom = self.settings._getMaskAtom if len(self.porttrees) == 1: repos = [None] @@ -1056,41 +1052,47 @@ class portdbapi(dbapi): writemsg("!!! %s\n" % (e,), noiselevel=-1) del e continue - eapi = metadata["EAPI"] - if not eapi_is_supported(eapi): - continue - if _eapi_is_deprecated(eapi): - continue - if not metadata["SLOT"]: - continue - if getMaskAtom(mycpv, metadata): - continue - if self.settings._getMissingKeywords(mycpv, metadata): + + if not self._visible(mycpv, metadata): continue - if local_config: - metadata['CHOST'] = chost - if not accept_chost(mycpv, metadata): - continue - metadata["USE"] = "" - if "?" in metadata["LICENSE"] or \ - "?" in metadata["PROPERTIES"]: - self.doebuild_settings.setcpv(mycpv, mydb=metadata) - metadata['USE'] = \ - self.doebuild_settings['PORTAGE_USE'] - try: - if self.settings._getMissingLicenses( - mycpv, metadata): - continue - if self.settings._getMissingProperties( - mycpv, metadata): - continue - except InvalidDependString: - continue yield mycpv # only yield a given cpv once break + def _visible(self, cpv, metadata): + eapi = metadata["EAPI"] + if not eapi_is_supported(eapi): + return False + if _eapi_is_deprecated(eapi): + return False + if not metadata["SLOT"]: + return False + + settings = self.settings + if settings._getMaskAtom(cpv, metadata): + return False + if settings._getMissingKeywords(cpv, metadata): + return False + if settings.local_config: + metadata['CHOST'] = settings.get('CHOST', '') + if not settings._accept_chost(cpv, metadata): + return False + metadata["USE"] = "" + if "?" in metadata["LICENSE"] or \ + "?" in metadata["PROPERTIES"]: + self.doebuild_settings.setcpv(cpv, mydb=metadata) + metadata['USE'] = self.doebuild_settings['PORTAGE_USE'] + try: + if settings._getMissingLicenses(cpv, metadata): + return False + if settings._getMissingProperties(cpv, metadata): + return False + except InvalidDependString: + return False + + return True + def close_portdbapi_caches(): for i in portdbapi.portdbapi_instances: i.close_caches() -- cgit v1.2.3-1-g7c22