1 |
I've renamed PYTHON_DEPEND to avoid confusion with python.eclass. |
2 |
--- |
3 |
gx86/eclass/python-distutils-ng.eclass | 20 ++----------------- |
4 |
gx86/eclass/python-r1.eclass | 35 ++++++++++++++++++++++++++++++++-- |
5 |
2 files changed, 35 insertions(+), 20 deletions(-) |
6 |
|
7 |
diff --git a/gx86/eclass/python-distutils-ng.eclass b/gx86/eclass/python-distutils-ng.eclass |
8 |
index 5df965c..34717aa 100644 |
9 |
--- a/gx86/eclass/python-distutils-ng.eclass |
10 |
+++ b/gx86/eclass/python-distutils-ng.eclass |
11 |
@@ -74,24 +74,8 @@ _python-distutils-ng_get_binary_for_implementation() { |
12 |
esac |
13 |
} |
14 |
|
15 |
-for impl in ${PYTHON_COMPAT[@]}; do |
16 |
- dep_str="${impl/_/.}" |
17 |
- case "${dep_str}" in |
18 |
- python?.?) |
19 |
- dep_str="dev-lang/python:${dep_str: -3}" ;; |
20 |
- jython?.?) |
21 |
- dep_str="dev-java/jython:${dep_str: -3}" ;; |
22 |
- pypy?.?) |
23 |
- dep_str="dev-python/pypy:${dep_str: -3}" ;; |
24 |
- *) |
25 |
- die "Unsupported implementation: ${impl}" ;; |
26 |
- esac |
27 |
- dep_str="python_targets_${impl}? ( ${dep_str} )" |
28 |
- |
29 |
- RDEPEND="${RDEPEND} ${dep_str}" |
30 |
- DEPEND="${DEPEND} ${dep_str}" |
31 |
- unset dep_str |
32 |
-done |
33 |
+RDEPEND=${PYTHON_DEPS} |
34 |
+DEPEND=${PYTHON_DEPS} |
35 |
|
36 |
_PACKAGE_SPECIFIC_S="${S#${WORKDIR}/}" |
37 |
|
38 |
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass |
39 |
index 18f9246..957db68 100644 |
40 |
--- a/gx86/eclass/python-r1.eclass |
41 |
+++ b/gx86/eclass/python-r1.eclass |
42 |
@@ -40,14 +40,45 @@ _PYTHON_ALL_IMPLS=( |
43 |
# a package supports. It must be set before the `inherit' call. |
44 |
# The default is to enable all implementations. |
45 |
# |
46 |
-# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar, the eclass |
47 |
-# will implicitly convert it to an array. |
48 |
+# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar, |
49 |
+# the eclass will implicitly convert it to an array. |
50 |
: ${PYTHON_COMPAT:=${_PYTHON_ALL_IMPLS[@]}} |
51 |
|
52 |
+# @ECLASS-VARIABLE: PYTHON_DEPS |
53 |
+# @DESCRIPTION: |
54 |
+# This is an eclass-generated Python dependency string for all |
55 |
+# implementations listed in PYTHON_COMPAT. It should be used |
56 |
+# in RDEPEND and/or DEPEND like: |
57 |
+# |
58 |
+# @CODE |
59 |
+# RDEPEND="${PYTHON_DEPS} |
60 |
+# dev-foo/mydep" |
61 |
+# DEPEND="${RDEPEND}" |
62 |
+# @CODE |
63 |
+ |
64 |
PYTHON_COMPAT=( ${PYTHON_COMPAT[@]} ) |
65 |
|
66 |
_python_set_globals() { |
67 |
IUSE=${PYTHON_COMPAT[@]/#/python_targets_} |
68 |
REQUIRED_USE="|| ( ${IUSE} )" |
69 |
+ |
70 |
+ PYTHON_DEPS= |
71 |
+ local i |
72 |
+ for i in ${PYTHON_COMPAT[@]}; do |
73 |
+ local d |
74 |
+ case ${i} in |
75 |
+ python*) |
76 |
+ d='dev-lang/python';; |
77 |
+ jython*) |
78 |
+ d='dev-java/jython';; |
79 |
+ pypy*) |
80 |
+ d='dev-python/pypy';; |
81 |
+ *) |
82 |
+ die "Invalid implementation: ${i}" |
83 |
+ esac |
84 |
+ |
85 |
+ local v=${i##*[a-z]} |
86 |
+ PYTHON_DEPS+=" python_targets_${i}? ( ${d}:${v/_/.} )" |
87 |
+ done |
88 |
} |
89 |
_python_set_globals |
90 |
-- |
91 |
1.7.12 |