Gentoo Archives: gentoo-portage-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-portage-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-portage-dev] [PATCH] Make eapi_is_supported() reuse _supported_eapis list
Date: Sun, 17 Aug 2014 19:04:58
Message-Id: 1408302344-14354-1-git-send-email-mgorny@gentoo.org
1 Make the eapi_is_supported() function use the generated list of
2 supported EAPIs rather than partial lists and integer comparison.
3 ---
4 pym/portage/__init__.py | 14 +-------------
5 1 file changed, 1 insertion(+), 13 deletions(-)
6
7 diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
8 index 18b2599..66bfeb0 100644
9 --- a/pym/portage/__init__.py
10 +++ b/pym/portage/__init__.py
11 @@ -505,19 +505,7 @@ def eapi_is_supported(eapi):
12 eapi = str(eapi)
13 eapi = eapi.strip()
14
15 - if _eapi_is_deprecated(eapi):
16 - return True
17 -
18 - if eapi in _testing_eapis:
19 - return True
20 -
21 - try:
22 - eapi = int(eapi)
23 - except ValueError:
24 - eapi = -1
25 - if eapi < 0:
26 - return False
27 - return eapi <= portage.const.EAPI
28 + return eapi in _supported_eapis
29
30 # This pattern is specified by PMS section 7.3.1.
31 _pms_eapi_re = re.compile(r"^[ \t]*EAPI=(['\"]?)([A-Za-z0-9+_.-]*)\1[ \t]*([ \t]#.*)?$")
32 --
33 2.0.4