1 |
Add a function to query IUSE_EFFECTIVE for flags. |
2 |
--- |
3 |
bin/eapi.sh | 4 ++++ |
4 |
bin/phase-helpers.sh | 16 ++++++++++++++++ |
5 |
pym/portage/eapi.py | 3 +++ |
6 |
pym/portage/package/ebuild/doebuild.py | 2 +- |
7 |
4 files changed, 24 insertions(+), 1 deletion(-) |
8 |
|
9 |
diff --git a/bin/eapi.sh b/bin/eapi.sh |
10 |
index c650a4c..e0ade02 100644 |
11 |
--- a/bin/eapi.sh |
12 |
+++ b/bin/eapi.sh |
13 |
@@ -80,6 +80,10 @@ ___eapi_has_eapply_user() { |
14 |
[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] |
15 |
} |
16 |
|
17 |
+___eapi_has_in_iuse() { |
18 |
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]] |
19 |
+} |
20 |
+ |
21 |
___eapi_has_master_repositories() { |
22 |
[[ ${1-${EAPI}} =~ ^(5-progress)$ ]] |
23 |
} |
24 |
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh |
25 |
index 60f7a39..2eada2f 100644 |
26 |
--- a/bin/phase-helpers.sh |
27 |
+++ b/bin/phase-helpers.sh |
28 |
@@ -973,6 +973,22 @@ if ___eapi_has_eapply_user; then |
29 |
} |
30 |
fi |
31 |
|
32 |
+if ___eapi_has_in_iuse; then |
33 |
+ in_iuse() { |
34 |
+ local use=${1} |
35 |
+ |
36 |
+ if [[ -z "${use}" ]]; then |
37 |
+ echo "!!! in_iuse() called without a parameter." >&2 |
38 |
+ echo "!!! in_iuse <USEFLAG>" >&2 |
39 |
+ die "in_iuse() called without a parameter" |
40 |
+ fi |
41 |
+ |
42 |
+ local liuse=( ${IUSE_EFFECTIVE} ) |
43 |
+ |
44 |
+ has "${use}" "${liuse[@]#[+-]}" |
45 |
+ } |
46 |
+fi |
47 |
+ |
48 |
if ___eapi_has_master_repositories; then |
49 |
master_repositories() { |
50 |
local output repository=$1 retval |
51 |
diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py |
52 |
index 7217d23..386c81d 100644 |
53 |
--- a/pym/portage/eapi.py |
54 |
+++ b/pym/portage/eapi.py |
55 |
@@ -68,6 +68,9 @@ def eapi_has_required_use_at_most_one_of(eapi): |
56 |
def eapi_has_use_dep_defaults(eapi): |
57 |
return eapi not in ("0", "1", "2", "3") |
58 |
|
59 |
+def eapi_has_in_iuse(eapi): |
60 |
+ return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi", "5", "5-progress") |
61 |
+ |
62 |
def eapi_has_repo_deps(eapi): |
63 |
return eapi in ("4-python", "5-progress") |
64 |
|
65 |
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py |
66 |
index 01707ae..29fb0df 100644 |
67 |
--- a/pym/portage/package/ebuild/doebuild.py |
68 |
+++ b/pym/portage/package/ebuild/doebuild.py |
69 |
@@ -54,7 +54,7 @@ from portage.dep import Atom, check_required_use, \ |
70 |
from portage.eapi import eapi_exports_KV, eapi_exports_merge_type, \ |
71 |
eapi_exports_replace_vars, eapi_exports_REPOSITORY, \ |
72 |
eapi_has_required_use, eapi_has_src_prepare_and_src_configure, \ |
73 |
- eapi_has_pkg_pretend, _get_eapi_attrs |
74 |
+ eapi_has_pkg_pretend, _get_eapi_attrs, eapi_has_in_iuse |
75 |
from portage.elog import elog_process, _preload_elog_modules |
76 |
from portage.elog.messages import eerror, eqawarn |
77 |
from portage.exception import DigestException, FileNotFound, \ |
78 |
-- |
79 |
2.0.4 |