From: Zac Medico Date: Fri, 1 Jun 2012 22:51:10 +0000 (-0700) Subject: config: lazy MaskManager instantiation X-Git-Tag: v2.2.0_alpha109~13 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=09980f19e584b644b9e2cf4d5e1e0369b6062ca1;p=portage.git config: lazy MaskManager instantiation --- diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 6f5680bdc..046ec465f 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -181,6 +181,7 @@ class config(object): # can practically render the api unusable for api consumers. tolerant = hasattr(portage, '_initializing_globals') self._tolerant = tolerant + self._unmatched_removal = _unmatched_removal self.locked = 0 self.mycpv = None @@ -205,6 +206,7 @@ class config(object): # For immutable attributes, use shallow copy for # speed and memory conservation. self._tolerant = clone._tolerant + self._unmatched_removal = clone._unmatched_removal self.categories = clone.categories self.depcachedir = clone.depcachedir self.incrementals = clone.incrementals @@ -229,10 +231,10 @@ class config(object): # immutable attributes (internal policy ensures lack of mutation) self._locations_manager = clone._locations_manager self._use_manager = clone._use_manager - self._mask_manager = clone._mask_manager # force instantiation of lazy immutable objects when cloning, so # that they're not instantiated more than once self._keywords_manager_obj = clone._keywords_manager + self._mask_manager_obj = clone._mask_manager # shared mutable attributes self._unknown_features = clone._unknown_features @@ -279,6 +281,7 @@ class config(object): else: # lazily instantiated objects self._keywords_manager_obj = None + self._mask_manager_obj = None locations_manager = LocationsManager(config_root=config_root, config_profile_path=config_profile_path, eprefix=eprefix, @@ -598,11 +601,6 @@ class config(object): self._license_manager.extract_global_changes( \ self.configdict["conf"].get("ACCEPT_LICENSE", "")) - #Read package.mask and package.unmask from profiles and optionally from user config - self._mask_manager = MaskManager(self.repositories, profiles_complex, - abs_user_config, user_config=local_config, - strict_umatched_removal=_unmatched_removal) - self._virtuals_manager = VirtualsManager(self.profiles) if local_config: @@ -894,6 +892,16 @@ class config(object): global_accept_keywords=self.configdict["defaults"].get("ACCEPT_KEYWORDS", "")) return self._keywords_manager_obj + @property + def _mask_manager(self): + if self._mask_manager_obj is None: + self._mask_manager_obj = MaskManager(self.repositories, + self._locations_manager.profiles_complex, + self._locations_manager.abs_user_config, + user_config=self.local_config, + strict_umatched_removal=self._unmatched_removal) + return self._mask_manager_obj + @property def pkeywordsdict(self): result = self._keywords_manager.pkeywordsdict.copy()