As requested by hasufell.
---
 gx86/eclass/python-r1.eclass | 30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index 487b5e0..9659310 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -36,14 +36,33 @@ _PYTHON_ALL_IMPLS=(
 
 # @ECLASS-VARIABLE: PYTHON_COMPAT
 # @DESCRIPTION:
-# This variable contains a space separated list of Pythonimplementations
-# a package supports. It must be set before the `inherit' call.
-# The default is to enable all implementations.
+# This variable contains a space separated list of Python
+# implementations a package supports. It must be set before
+# the `inherit' call.  The default is to enable all implementations.
 #
 # PYTHON_COMPAT can be either a scalar or an array. If it's a scalar,
 # the eclass will implicitly convert it to an array.
 : ${PYTHON_COMPAT:=${_PYTHON_ALL_IMPLS[@]}}
 
+# @ECLASS-VARIABLE: PYTHON_COMPAT_USE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The list of USEflags required to be enabled on the chosen Python
+# implementations, formed as a USE-dependency string. It should be valid
+# for all implementations in PYTHON_COMPAT, so it may be necessary to
+# use USE defaults.
+#
+# Example:
+# @CODE
+# PYTHON_COMPAT_USE="gdbm,ncurses(-)?"
+# @CODE
+#
+# Will cause the Python dependencies to look like:
+# @CODE
+# python_targets_pythonX_Y? (
+#   dev-lang/python:X_Y[gdbm,ncurses(-)?] )
+# @CODE
+
 # @ECLASS-VARIABLE: PYTHON_DEPS
 # @DESCRIPTION:
 # This is an eclass-generated Python dependency string for all
@@ -92,7 +111,10 @@ _python_set_globals() {
                esac
 
                local v=${i##*[a-z]}
-               PYTHON_DEPS+=" python_targets_${i}? ( ${d}:${v/_/.} )"
+               local usestr
+               [[ ${PYTHON_COMPAT_USE} ]] && usestr="[${PYTHON_COMPAT_USE}]"
+               PYTHON_DEPS+=" python_targets_${i}? (
+                       ${d}:${v/_/.}${usestr} )"
        done
 }
 _python_set_globals
-- 
1.7.12


Reply via email to