* [gentoo-python] [PATCH 1/2] Introduce python_gen_usedep & python_gen_useflags for special deps.
@ 2012-12-19 21:00 Michał Górny
2012-12-19 21:00 ` [gentoo-python] [PATCH 2/2] Use python_gen_*() functions to make the deps simpler Michał Górny
0 siblings, 1 reply; 2+ messages in thread
From: Michał Górny @ 2012-12-19 21:00 UTC (permalink / raw
To: gentoo-python; +Cc: python, Michał Górny
For example, when a particular dependency applies only to some
of the supported Python implementations.
The next patch provides example use for them.
---
gx86/eclass/python-r1.eclass | 78 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 78 insertions(+)
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index aa9153e..40ce68b 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -177,6 +177,84 @@ _python_set_globals() {
}
_python_set_globals
+# @FUNCTION: python_gen_usedep
+# @USAGE: pattern [...]
+# @DESCRIPTION:
+# Output a USE dependency string for Python implementations which
+# are both in PYTHON_COMPAT and match any of the patterns passed
+# as parameters to the function.
+#
+# When all implementations are requested, please use ${PYTHON_USEDEP}
+# instead. Please also remember to set an appropriate REQUIRED_USE
+# to avoid ineffective USE flags.
+#
+# Example:
+# @CODE
+# PYTHON_COMPAT=( python{2_7,3_2} )
+# DEPEND="doc? ( dev-python/epydoc[$(python_gen_usedep python2*)] )"
+# @CODE
+#
+# It will cause the dependency to look like:
+# @CODE
+# DEPEND="doc? ( dev-python/epydoc[python_targets_python2_7?] )"
+# @CODE
+python_gen_usedep() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local impl pattern
+ local matches=()
+
+ for impl in "${PYTHON_COMPAT[@]}"; do
+ for pattern; do
+ if [[ ${impl} == ${pattern} ]]; then
+ matches+=(
+ "python_targets_${impl}?"
+ "-python_single_target_${impl}(-)"
+ )
+ break
+ fi
+ done
+ done
+
+ local out=${matches[@]}
+ echo ${out// /,}
+}
+
+# @FUNCTION: python_gen_useflags
+# @USAGE: pattern [...]
+# @DESCRIPTION:
+# Output a list of USE flags for Python implementations which
+# are both in PYTHON_COMPAT and match any of the patterns passed
+# as parameters to the function.
+#
+# Example:
+# @CODE
+# PYTHON_COMPAT=( python{2_7,3_2} )
+# REQUIRED_USE="doc? ( || ( $(python_gen_useflags python2*) ) )"
+# @CODE
+#
+# It will cause the variable to look like:
+# @CODE
+# REQUIRED_USE="doc? ( || ( python_targets_python2_7 ) )"
+# @CODE
+python_gen_useflags() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local impl pattern
+ local matches=()
+
+ for impl in "${PYTHON_COMPAT[@]}"; do
+ for pattern; do
+ if [[ ${impl} == ${pattern} ]]; then
+ matches+=( "python_targets_${impl}" )
+ break
+ fi
+ done
+ done
+
+ echo ${matches[@]}
+}
+
# @ECLASS-VARIABLE: BUILD_DIR
# @DESCRIPTION:
# The current build directory. In global scope, it is supposed to
--
1.8.0.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-python] [PATCH 2/2] Use python_gen_*() functions to make the deps simpler.
2012-12-19 21:00 [gentoo-python] [PATCH 1/2] Introduce python_gen_usedep & python_gen_useflags for special deps Michał Górny
@ 2012-12-19 21:00 ` Michał Górny
0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2012-12-19 21:00 UTC (permalink / raw
To: gentoo-python; +Cc: python, Michał Górny
---
gx86/dev-python/dbus-python/dbus-python-1.1.1-r1.ebuild | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/gx86/dev-python/dbus-python/dbus-python-1.1.1-r1.ebuild b/gx86/dev-python/dbus-python/dbus-python-1.1.1-r1.ebuild
index f5e6f41..5c3f40b 100644
--- a/gx86/dev-python/dbus-python/dbus-python-1.1.1-r1.ebuild
+++ b/gx86/dev-python/dbus-python/dbus-python-1.1.1-r1.ebuild
@@ -17,7 +17,7 @@ SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
IUSE="doc examples test"
# API docs generated with epydoc, which is python2-only
-REQUIRED_USE="doc? ( || ( python_targets_python2_6 python_targets_python2_7 ) )"
+REQUIRED_USE="doc? ( || ( $(python_gen_useflags python2*) ) )"
RDEPEND=">=dev-libs/dbus-glib-0.100:=
>=sys-apps/dbus-1.6:=
@@ -25,8 +25,8 @@ RDEPEND=">=dev-libs/dbus-glib-0.100:=
DEPEND="${RDEPEND}
virtual/pkgconfig
doc? (
- dev-python/docutils[python_targets_python2_6?,python_targets_python2_7?]
- =dev-python/epydoc-3*[python_targets_python2_6?,python_targets_python2_7?] )
+ dev-python/docutils[$(python_gen_usedep python2*)]
+ =dev-python/epydoc-3*[$(python_gen_usedep python2*)] )
test? ( dev-python/pygobject:3 )"
# TODO: should be dev-python/pygobject:3[${PYTHON_USEDEP] when pygobject-3.4 is unmasked
--
1.8.0.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-12-19 21:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-19 21:00 [gentoo-python] [PATCH 1/2] Introduce python_gen_usedep & python_gen_useflags for special deps Michał Górny
2012-12-19 21:00 ` [gentoo-python] [PATCH 2/2] Use python_gen_*() functions to make the deps simpler 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