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 |