From 1272f5c55baa5c6d68d5ab3a1dceef69cc47e69b Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 16 Oct 2011 13:26:46 -0700 Subject: [PATCH] EbuildMetadataPhase: avoid redundant EAPI parsing --- pym/_emerge/EbuildMetadataPhase.py | 6 ++++-- pym/portage/dbapi/porttree.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pym/_emerge/EbuildMetadataPhase.py b/pym/_emerge/EbuildMetadataPhase.py index 2fbd29eb7..06cabe7d1 100644 --- a/pym/_emerge/EbuildMetadataPhase.py +++ b/pym/_emerge/EbuildMetadataPhase.py @@ -20,7 +20,7 @@ class EbuildMetadataPhase(SubProcess): used to extract metadata from the ebuild. """ - __slots__ = ("cpv", "ebuild_hash", "fd_pipes", "metadata_callback", + __slots__ = ("cpv", "eapi", "ebuild_hash", "fd_pipes", "metadata_callback", "metadata", "portdb", "repo_path", "settings") + \ ("_raw_metadata",) @@ -33,7 +33,9 @@ class EbuildMetadataPhase(SubProcess): settings.setcpv(self.cpv) ebuild_path = self.ebuild_hash.location - eapi = None + # the caller can pass in eapi in order to avoid + # redundant _parse_eapi_ebuild_head calls + eapi = self.eapi if eapi is None and \ 'parse-eapi-ebuild-head' in settings.features: eapi = portage._parse_eapi_ebuild_head( diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 13c27e979..0ade59a19 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -528,7 +528,7 @@ class portdbapi(dbapi): mydata = self._metadata_callback( mycpv, mylocation, {'EAPI':eapi}, ebuild_hash) else: - proc = EbuildMetadataPhase(cpv=mycpv, + proc = EbuildMetadataPhase(cpv=mycpv, eapi=eapi, ebuild_hash=ebuild_hash, metadata_callback=self._metadata_callback, portdb=self, repo_path=mylocation, -- 2.26.2