From 397cc5a82580e67284fd83835deddbc63f4a833f Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 26 Aug 2010 17:07:38 -0700 Subject: [PATCH] Use frozenset for config.usemask and useforce attributes, so there's no need to copy them during clone operations. Also, there's no need to copy config.puse since its an immutable string. --- pym/portage/package/ebuild/_config/UseManager.py | 8 ++++---- pym/portage/package/ebuild/config.py | 7 +++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/pym/portage/package/ebuild/_config/UseManager.py b/pym/portage/package/ebuild/_config/UseManager.py index b33e10a9d..9a3038bda 100644 --- a/pym/portage/package/ebuild/_config/UseManager.py +++ b/pym/portage/package/ebuild/_config/UseManager.py @@ -76,7 +76,7 @@ class UseManager(object): def getUseMask(self, pkg=None): if pkg is None: - return set(stack_lists( + return frozenset(stack_lists( self._usemask_list, incremental=True)) cp = getattr(pkg, "cp", None) @@ -91,11 +91,11 @@ class UseManager(object): pkg_usemask = ordered_by_atom_specificity(cpdict, pkg) if pkg_usemask: usemask.extend(pkg_usemask) - return set(stack_lists(usemask, incremental=True)) + return frozenset(stack_lists(usemask, incremental=True)) def getUseForce(self, pkg=None): if pkg is None: - return set(stack_lists( + return frozenset(stack_lists( self._useforce_list, incremental=True)) cp = getattr(pkg, "cp", None) @@ -110,7 +110,7 @@ class UseManager(object): pkg_useforce = ordered_by_atom_specificity(cpdict, pkg) if pkg_useforce: useforce.extend(pkg_useforce) - return set(stack_lists(useforce, incremental=True)) + return frozenset(stack_lists(useforce, incremental=True)) def getPUSE(self, pkg): cp = getattr(pkg, "cp", None) diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index 408f10649..eba8d77e0 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -403,6 +403,9 @@ class config(object): self.packages = clone.packages self._iuse_implicit_match = clone._iuse_implicit_match self._non_user_variables = clone._non_user_variables + self.usemask = clone.usemask + self.useforce = clone.useforce + self.puse = clone.puse self.user_profile_dir = copy.deepcopy(clone.user_profile_dir) self.local_config = copy.deepcopy(clone.local_config) @@ -417,10 +420,6 @@ class config(object): self.userVirtuals = copy.deepcopy(clone.userVirtuals) self.negVirtuals = copy.deepcopy(clone.negVirtuals) self._depgraphVirtuals = copy.deepcopy(clone._depgraphVirtuals) - - self.usemask = copy.deepcopy(clone.usemask) - self.useforce = copy.deepcopy(clone.useforce) - self.puse = copy.deepcopy(clone.puse) self._penv = copy.deepcopy(clone._penv) self.make_defaults_use = copy.deepcopy(clone.make_defaults_use) self.mycpv = copy.deepcopy(clone.mycpv) -- 2.26.2