diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-06-26 23:53:58 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-06-26 23:53:58 -0700 |
commit | 7587568f3133d12ef68b633328954cb838fcaafe (patch) | |
tree | 426978791ef73de284182f58b5decc3611e95e67 | |
parent | 33997cfc32cd9457e656c7ecbfab6ff5e2c62885 (diff) | |
download | portage-7587568f3133d12ef68b633328954cb838fcaafe.tar.gz portage-7587568f3133d12ef68b633328954cb838fcaafe.tar.bz2 portage-7587568f3133d12ef68b633328954cb838fcaafe.zip |
Package.use: share identical frozenset instances
-rw-r--r-- | pym/_emerge/Package.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/pym/_emerge/Package.py b/pym/_emerge/Package.py index 7a25638c8..20c72b481 100644 --- a/pym/_emerge/Package.py +++ b/pym/_emerge/Package.py @@ -392,6 +392,9 @@ class Package(Task): __slots__ = ("enabled", "_expand", "_expand_hidden", "_force", "_pkg", "_mask") + # Share identical frozenset instances when available. + _frozensets = {} + def __init__(self, pkg, use_str): self._pkg = pkg self._expand = None @@ -410,12 +413,17 @@ class Package(Task): def _init_force_mask(self): pkgsettings = self._pkg._get_pkgsettings() - self._expand = frozenset( + frozensets = self._frozensets + s = frozenset( pkgsettings.get("USE_EXPAND", "").lower().split()) - self._expand_hidden = frozenset( + self._expand = frozensets.setdefault(s, s) + s = frozenset( pkgsettings.get("USE_EXPAND_HIDDEN", "").lower().split()) - self._force = pkgsettings.useforce - self._mask = pkgsettings.usemask + self._expand_hidden = frozensets.setdefault(s, s) + s = pkgsettings.useforce + self._force = frozensets.setdefault(s, s) + s = pkgsettings.usemask + self._mask = frozensets.setdefault(s, s) @property def expand(self): |