* [gentoo-portage-dev] [PATCH 12/13] Add tentative EAPI6 in_iuse() function
@ 2014-08-18 17:56 99% ` Michał Górny
0 siblings, 0 replies; 1+ results
From: Michał Górny @ 2014-08-18 17:56 UTC (permalink / raw
To: gentoo-portage-dev; +Cc: Michał Górny
Add a function to query IUSE_EFFECTIVE for flags.
---
bin/eapi.sh | 4 ++++
bin/phase-helpers.sh | 16 ++++++++++++++++
pym/portage/eapi.py | 3 +++
pym/portage/package/ebuild/doebuild.py | 2 +-
4 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/bin/eapi.sh b/bin/eapi.sh
index c650a4c..e0ade02 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -80,6 +80,10 @@ ___eapi_has_eapply_user() {
[[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
}
+___eapi_has_in_iuse() {
+ [[ ! ${1-${EAPI}} =~ ^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+}
+
___eapi_has_master_repositories() {
[[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
}
diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 60f7a39..2eada2f 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -973,6 +973,22 @@ if ___eapi_has_eapply_user; then
}
fi
+if ___eapi_has_in_iuse; then
+ in_iuse() {
+ local use=${1}
+
+ if [[ -z "${use}" ]]; then
+ echo "!!! in_iuse() called without a parameter." >&2
+ echo "!!! in_iuse <USEFLAG>" >&2
+ die "in_iuse() called without a parameter"
+ fi
+
+ local liuse=( ${IUSE_EFFECTIVE} )
+
+ has "${use}" "${liuse[@]#[+-]}"
+ }
+fi
+
if ___eapi_has_master_repositories; then
master_repositories() {
local output repository=$1 retval
diff --git a/pym/portage/eapi.py b/pym/portage/eapi.py
index 7217d23..386c81d 100644
--- a/pym/portage/eapi.py
+++ b/pym/portage/eapi.py
@@ -68,6 +68,9 @@ def eapi_has_required_use_at_most_one_of(eapi):
def eapi_has_use_dep_defaults(eapi):
return eapi not in ("0", "1", "2", "3")
+def eapi_has_in_iuse(eapi):
+ return eapi not in ("0", "1", "2", "3", "4", "4-python", "4-slot-abi", "5", "5-progress")
+
def eapi_has_repo_deps(eapi):
return eapi in ("4-python", "5-progress")
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 01707ae..29fb0df 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -54,7 +54,7 @@ from portage.dep import Atom, check_required_use, \
from portage.eapi import eapi_exports_KV, eapi_exports_merge_type, \
eapi_exports_replace_vars, eapi_exports_REPOSITORY, \
eapi_has_required_use, eapi_has_src_prepare_and_src_configure, \
- eapi_has_pkg_pretend, _get_eapi_attrs
+ eapi_has_pkg_pretend, _get_eapi_attrs, eapi_has_in_iuse
from portage.elog import elog_process, _preload_elog_modules
from portage.elog.messages import eerror, eqawarn
from portage.exception import DigestException, FileNotFound, \
--
2.0.4
^ permalink raw reply related [relevance 99%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2014-08-18 17:56 [gentoo-portage-dev] [PATCHES] Initial EAPI6 patch set for review Michał Górny
2014-08-18 17:56 99% ` [gentoo-portage-dev] [PATCH 12/13] Add tentative EAPI6 in_iuse() function Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox