1 |
commit: fbf6518406ddb79a999b7d1230046ad93adc445d |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sun Aug 26 22:31:01 2012 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Sun Aug 26 22:31:01 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=fbf65184 |
7 |
|
8 |
_get_eapi_attrs: handle unsupported eapi as None |
9 |
|
10 |
--- |
11 |
pym/portage/eapi.py | 11 ++++++++++- |
12 |
1 files changed, 10 insertions(+), 1 deletions(-) |
13 |
|
14 |
diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py |
15 |
index 8b03f83..a5ef301 100644 |
16 |
--- a/pym/portage/eapi.py |
17 |
+++ b/pym/portage/eapi.py |
18 |
@@ -3,6 +3,8 @@ |
19 |
|
20 |
import collections |
21 |
|
22 |
+from portage import eapi_is_supported |
23 |
+ |
24 |
def eapi_has_iuse_defaults(eapi): |
25 |
return eapi != "0" |
26 |
|
27 |
@@ -77,11 +79,18 @@ def _get_eapi_attrs(eapi): |
28 |
""" |
29 |
When eapi is None then validation is not as strict, since we want the |
30 |
same to work for multiple EAPIs that may have slightly different rules. |
31 |
+ An unsupported eapi is handled the same as when eapi is None, which may |
32 |
+ be helpful for handling of corrupt EAPI metadata in essential functions |
33 |
+ such as pkgsplit. |
34 |
""" |
35 |
eapi_attrs = _eapi_attrs_cache.get(eapi) |
36 |
if eapi_attrs is not None: |
37 |
return eapi_attrs |
38 |
|
39 |
+ orig_eapi = eapi |
40 |
+ if eapi is not None and not eapi_is_supported(eapi): |
41 |
+ eapi = None |
42 |
+ |
43 |
eapi_attrs = _eapi_attrs( |
44 |
dots_in_PN = (eapi is None or eapi_allows_dots_in_PN(eapi)), |
45 |
dots_in_use_flags = (eapi is None or eapi_allows_dots_in_use_flags(eapi)), |
46 |
@@ -96,5 +105,5 @@ def _get_eapi_attrs(eapi): |
47 |
use_dep_defaults = (eapi is None or eapi_has_use_dep_defaults(eapi)) |
48 |
) |
49 |
|
50 |
- _eapi_attrs_cache[eapi] = eapi_attrs |
51 |
+ _eapi_attrs_cache[orig_eapi] = eapi_attrs |
52 |
return eapi_attrs |