Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: Re: [gentoo-portage-dev] [PATCH 3/4] EAPI 6: Enforce posixish LC_CTYPE
Date: Sun, 15 Nov 2015 22:23:20
Message-Id: 564905D1.6050407@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH 3/4] EAPI 6: Enforce posixish LC_CTYPE by "Michał Górny"
1 On 11/15/2015 01:17 PM, Michał Górny wrote:
2
3 > -def check_locale():
4 > +def check_locale(silent=False, env=None):
5
6 We should memoize the result of this function, using the cache_key
7 pattern used by many of the functions in portage.dep module.
8
9 For example:
10
11 _check_locale_cache = {}
12
13 def check_locale(silent=False, env=None):
14 if env is None:
15 cache_key = None
16 else:
17 cache_key = frozenset((k, env.get(k)) for k in
18 locale_categories + ('LC_ALL',))
19 try:
20 return _check_locale_cache[cache_key]
21 except KeyError:
22 pass
23 ...
24
25 --
26 Thanks,
27 Zac