Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o, Matt Turner <mattst88@g.o>
Cc: "Wolfgang E. Sanyer" <WolfgangESanyer@×××××.com>
Subject: Re: [gentoo-portage-dev] [PATCH 4/4] portage.eapi: use functools @lru_cache decorator instead of custom implementation
Date: Sat, 26 Feb 2022 18:04:45
Message-Id: 0f60298e-6142-2c44-eee1-4497909fb947@gentoo.org
In Reply to: [gentoo-portage-dev] [PATCH 4/4] portage.eapi: use functools @lru_cache decorator instead of custom implementation by Matt Turner
1 On 2/23/22 20:14, Matt Turner wrote:
2 > From: "Wolfgang E. Sanyer" <WolfgangESanyer@×××××.com>
3 >
4 > Reviewed-by: Matt Turner <mattst88@g.o>
5 > Signed-off-by: Wolfgang E. Sanyer <WolfgangESanyer@×××××.com>
6 > ---
7 > lib/portage/eapi.py | 155 ++++++++++++++++++++------------------------
8 > 1 file changed, 72 insertions(+), 83 deletions(-)
9 >
10 > diff --git a/lib/portage/eapi.py b/lib/portage/eapi.py
11 > index 56e64620a..efcc6c2a0 100644
12 > --- a/lib/portage/eapi.py
13 > +++ b/lib/portage/eapi.py
14 > @@ -2,12 +2,10 @@
15 > # Distributed under the terms of the GNU General Public License v2
16 >
17 > import collections
18 > -import operator
19 > -import types
20 > -
21 > -from portage import eapi_is_supported
22 > +from functools import lru_cache
23 >
24 >
25 > +@lru_cache(None)
26 > def eapi_has_iuse_defaults(eapi):
27 > if eapi is None:
28 > return True
29 > @@ -15,6 +13,7 @@ def eapi_has_iuse_defaults(eapi):
30 > return eapi != "0"
31
32 I think this patch misses the point of the original caching mechanism.
33 It doesn't make sense to cache results of the individual eapi_*
34 functions if they no longer contribute to the _eapi_attrs cache.
35 --
36 Thanks,
37 Zac

Attachments

File name MIME type
OpenPGP_signature.asc application/pgp-signature

Replies