---
 gx86/eclass/python-distutils-ng.eclass | 31 ++------------------
 gx86/eclass/python-r1.eclass           | 53 ++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 29 deletions(-)
 create mode 100644 gx86/eclass/python-r1.eclass

diff --git a/gx86/eclass/python-distutils-ng.eclass 
b/gx86/eclass/python-distutils-ng.eclass
index edc38a4..5df965c 100644
--- a/gx86/eclass/python-distutils-ng.eclass
+++ b/gx86/eclass/python-distutils-ng.eclass
@@ -26,26 +26,6 @@
 #    each implementation and python_install_all that will be run in original
 #    directory (so it will not contain any implementation-specific files)
 
-# @ECLASS-VARIABLE: PYTHON_COMPAT
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# This variable contains a space separated list of implementations (see above) 
a
-# package is compatible to. 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.
-
-if [[ -z "${PYTHON_COMPAT}" ]]; then
-       # Default: pure python, support all implementations
-       PYTHON_COMPAT="  python2_5 python2_6 python2_7"
-       PYTHON_COMPAT+=" python3_1 python3_2"
-       PYTHON_COMPAT+=" jython2_5"
-       PYTHON_COMPAT+=" pypy1_8 pypy1_9"
-fi
-
-PYTHON_COMPAT=( ${PYTHON_COMPAT[@]} )
-
 # @ECLASS-VARIABLE: PYTHON_DISABLE_COMPILATION
 # @DEFAULT_UNSET
 # @DESCRIPTION:
@@ -68,6 +48,8 @@ case "${EAPI}" in
                die "Unsupported EAPI=${EAPI} (unknown) for 
python-distutils-ng.eclass" ;;
 esac
 
+inherit python-r1
+
 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
 
 DEPEND="${DEPEND} !<sys-apps/portage-2.1.10.58"
@@ -92,16 +74,7 @@ _python-distutils-ng_get_binary_for_implementation() {
        esac
 }
 
-required_use_str=""
-for impl in ${PYTHON_COMPAT[@]}; do
-       required_use_str+=" python_targets_${impl}"
-done
-required_use_str=" || ( ${required_use_str} )"
-REQUIRED_USE+=" ${required_use_str}"
-unset required_use_str
-
 for impl in ${PYTHON_COMPAT[@]}; do
-       IUSE+=" python_targets_${impl}"
        dep_str="${impl/_/.}"
        case "${dep_str}" in
                python?.?)
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
new file mode 100644
index 0000000..18f9246
--- /dev/null
+++ b/gx86/eclass/python-r1.eclass
@@ -0,0 +1,53 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+# @ECLASS: python-r1
+# @MAINTAINER:
+# Python herd <pyt...@gentoo.org>
+# @AUTHOR:
+# Author: Michał Górny <mgo...@gentoo.org>
+# Based on work of: Krzysztof Pawlik <nelch...@gentoo.org>
+# @BLURB: A common eclass for Python packages supporting multiple ABIs.
+# @DESCRIPTION:
+
+case "${EAPI}" in
+       0|1|2|3)
+               die "Unsupported EAPI=${EAPI} (too old) for ${ECLASS}"
+               ;;
+       4)
+               # EAPI=4 needed for REQUIRED_USE
+               ;;
+       *)
+               die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
+               ;;
+esac
+
+# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
+# @INTERNAL
+# @DESCRIPTION:
+# All supported Python implementations, most preferred first.
+_PYTHON_ALL_IMPLS=(
+       python2_7 python2_6 python2_5
+       python3_2 python3_1
+       pypy1_9 pypy1_8
+       jython2_5
+)
+
+# @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.
+#
+# 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[@]}}
+
+PYTHON_COMPAT=( ${PYTHON_COMPAT[@]} )
+
+_python_set_globals() {
+       IUSE=${PYTHON_COMPAT[@]/#/python_targets_}
+       REQUIRED_USE="|| ( ${IUSE} )"
+}
+_python_set_globals
-- 
1.7.12


Reply via email to