diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-08-26 18:22:06 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-08-26 18:22:06 -0700 |
commit | 84f40df3391d63550fb3fce02bd46c338a1a2633 (patch) | |
tree | 663285eb519b554e671573783fa6ff563ed704e2 | |
parent | 2cdbbf07b13e5ec0d7f033ed6bbdae57235f9158 (diff) | |
download | portage-84f40df3391d63550fb3fce02bd46c338a1a2633.tar.gz portage-84f40df3391d63550fb3fce02bd46c338a1a2633.tar.bz2 portage-84f40df3391d63550fb3fce02bd46c338a1a2633.zip |
Use shallow copy for more immutable config attributes.
-rw-r--r-- | pym/portage/package/ebuild/config.py | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py index c87ed3cf0..a978e33d1 100644 --- a/pym/portage/package/ebuild/config.py +++ b/pym/portage/package/ebuild/config.py @@ -383,13 +383,19 @@ class config(object): self.usemask = clone.usemask self.useforce = clone.useforce self.puse = clone.puse + self.user_profile_dir = clone.user_profile_dir + self.local_config = clone.local_config + self.make_defaults_use = clone.make_defaults_use + self.mycpv = clone.mycpv + self._setcpv_args_hash = clone._setcpv_args_hash + + # immutable attributes (internal policy ensures lack of mutation) + self._local_repo_configs = clone._local_repo_configs + self._local_repo_conf_path = clone._local_repo_conf_path + self._pkeywords_list = clone._pkeywords_list + self._p_accept_keywords = clone._p_accept_keywords + self._use_manager = clone._use_manager - self.user_profile_dir = copy.deepcopy(clone.user_profile_dir) - self.local_config = copy.deepcopy(clone.local_config) - self._local_repo_configs = \ - copy.deepcopy(clone._local_repo_configs) - self._local_repo_conf_path = \ - copy.deepcopy(clone._local_repo_conf_path) self.modules = copy.deepcopy(clone.modules) self.virtuals = copy.deepcopy(clone.virtuals) self.dirVirtuals = copy.deepcopy(clone.dirVirtuals) @@ -398,9 +404,6 @@ class config(object): self.negVirtuals = copy.deepcopy(clone.negVirtuals) self._depgraphVirtuals = copy.deepcopy(clone._depgraphVirtuals) self._penv = copy.deepcopy(clone._penv) - self.make_defaults_use = copy.deepcopy(clone.make_defaults_use) - self.mycpv = copy.deepcopy(clone.mycpv) - self._setcpv_args_hash = copy.deepcopy(clone._setcpv_args_hash) self.configdict = copy.deepcopy(clone.configdict) self.configlist = [ @@ -418,8 +421,6 @@ class config(object): self._use_expand_dict = copy.deepcopy(clone._use_expand_dict) self.backupenv = self.configdict["backupenv"] self.pkeywordsdict = copy.deepcopy(clone.pkeywordsdict) - self._pkeywords_list = copy.deepcopy(clone._pkeywords_list) - self._p_accept_keywords = copy.deepcopy(clone._p_accept_keywords) self.pmaskdict = copy.deepcopy(clone.pmaskdict) self.punmaskdict = copy.deepcopy(clone.punmaskdict) self.prevmaskdict = copy.deepcopy(clone.prevmaskdict) @@ -434,9 +435,6 @@ class config(object): self._penvdict = copy.deepcopy(clone._penvdict) self._expand_map = copy.deepcopy(clone._expand_map) - #No need to copy the managers, they contain only static information. - self._use_manager = clone._use_manager - else: def check_var_directory(varname, var): @@ -586,6 +584,7 @@ class config(object): for k, v in pkeyworddict.items(): cpdict.setdefault(k.cp, {})[k] = v self._pkeywords_list.append(cpdict) + self._pkeywords_list = tuple(self._pkeywords_list) self._p_accept_keywords = [] raw_p_accept_keywords = [grabdict_package( @@ -599,6 +598,7 @@ class config(object): for k, v in d.items(): cpdict.setdefault(k.cp, {})[k] = tuple(v) self._p_accept_keywords.append(cpdict) + self._p_accept_keywords = tuple(self._p_accept_keywords) make_conf = getconfig( os.path.join(config_root, MAKE_CONF_FILE), @@ -725,6 +725,7 @@ class config(object): self.make_defaults_use.append(cfg.get("USE", "")) else: self.make_defaults_use.append("") + self.make_defaults_use = tuple(self.make_defaults_use) self.mygcfg = stack_dicts(mygcfg_dlists, incrementals=self.incrementals) if self.mygcfg is None: |