I am missing a replacement for PYTHON_USE_WITH.

Would the attached patch help in any way? Review? Other ideas?
--- python-distutils-ng.eclass
+++ python-distutils-ng.eclass
@@ -59,6 +59,25 @@
 # Set to any value to disable automatic reinstallation of scripts in bin
 # directories. See python-distutils-ng_src_install function.
 
+# @ECLASS-VARIABLE: PYTHON_USE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# comma seperated list of useflags needed for python
+# this is directly substituted into dev-lang/python[${PYTHON_USE}] thus allowing
+# all valid useflag dependencies
+# example 1: PYTHON_USE="xml,sqlite"
+# example 2: PYTHON_USE="xml?,threads?,-foo"
+
+# @ECLASS-VARIABLE: JYTHON_USE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# same as PYTHON_USE just for JYTHON
+
+# @ECLASS-VARIABLE: PYPY_USE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# same as PYTHON_USE just for PYPY
+
 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
 
 case "${EAPI}" in
@@ -107,16 +126,22 @@
 fi
 unset required_use_str
 
+# avoid empty use deps
+[[ -n ${PYTHON_USE} ]] && _PYTHON_USE="[${PYTHON_USE}]" || _PYTHON_USE=""
+[[ -n ${JYTHON_USE} ]] && _JYTHON_USE="[${JYTHON_USE}]" || _JYTHON_USE=""
+[[ -n ${PYPY_USE} ]] && _PYPY_USE="[${PYPY_USE}]" || _PYPY_USE=""
+
+# set python DEPEND and RDEPEND
 for impl in ${PYTHON_COMPAT}; do
 	IUSE+=" python_targets_${impl}"
 	dep_str="${impl/_/.}"
 	case "${dep_str}" in
 		python?.?)
-			dep_str="dev-lang/python:${dep_str: -3}" ;;
+			dep_str="dev-lang/python:${dep_str: -3}${_PYTHON_USE}" ;;
 		jython?.?)
-			dep_str="dev-java/jython:${dep_str: -3}" ;;
+			dep_str="dev-java/jython:${dep_str: -3}${_JYTHON_USE}" ;;
 		pypy?.?)
-			dep_str="dev-python/pypy:${dep_str: -3}" ;;
+			dep_str="dev-python/pypy:${dep_str: -3}${_PYPY_USE}" ;;
 		*)
 			die "Unsupported implementation: ${impl}" ;;
 	esac

Reply via email to