Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 6/6] Generate python depstrings in python-r1.
Date: Wed, 19 Sep 2012 10:06:03
Message-Id: 1348048827-1290-6-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 1/6] Drop pointless default S assignment. by "Michał Górny"
1 ---
2 gx86/eclass/python-distutils-ng.eclass | 20 ++------------------
3 gx86/eclass/python-r1.eclass | 28 ++++++++++++++++++++++++++--
4 2 files changed, 28 insertions(+), 20 deletions(-)
5
6 diff --git a/gx86/eclass/python-distutils-ng.eclass b/gx86/eclass/python-distutils-ng.eclass
7 index 5df965c..bffe563 100644
8 --- a/gx86/eclass/python-distutils-ng.eclass
9 +++ b/gx86/eclass/python-distutils-ng.eclass
10 @@ -74,24 +74,8 @@ _python-distutils-ng_get_binary_for_implementation() {
11 esac
12 }
13
14 -for impl in ${PYTHON_COMPAT[@]}; do
15 - dep_str="${impl/_/.}"
16 - case "${dep_str}" in
17 - python?.?)
18 - dep_str="dev-lang/python:${dep_str: -3}" ;;
19 - jython?.?)
20 - dep_str="dev-java/jython:${dep_str: -3}" ;;
21 - pypy?.?)
22 - dep_str="dev-python/pypy:${dep_str: -3}" ;;
23 - *)
24 - die "Unsupported implementation: ${impl}" ;;
25 - esac
26 - dep_str="python_targets_${impl}? ( ${dep_str} )"
27 -
28 - RDEPEND="${RDEPEND} ${dep_str}"
29 - DEPEND="${DEPEND} ${dep_str}"
30 - unset dep_str
31 -done
32 +RDEPEND=${PYTHON_DEPEND}
33 +DEPEND=${PYTHON_DEPEND}
34
35 _PACKAGE_SPECIFIC_S="${S#${WORKDIR}/}"
36
37 diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
38 index 18f9246..3017dd8 100644
39 --- a/gx86/eclass/python-r1.eclass
40 +++ b/gx86/eclass/python-r1.eclass
41 @@ -40,14 +40,38 @@ _PYTHON_ALL_IMPLS=(
42 # a package supports. It must be set before the `inherit' call.
43 # The default is to enable all implementations.
44 #
45 -# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar, the eclass
46 -# will implicitly convert it to an array.
47 +# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar,
48 +# the eclass will implicitly convert it to an array.
49 : ${PYTHON_COMPAT:=${_PYTHON_ALL_IMPLS[@]}}
50
51 +# @ECLASS-VARIABLE: PYTHON_DEPEND
52 +# @DESCRIPTION:
53 +# This is an eclass-generated Python dependency string for all
54 +# implementations listed in PYTHON_COMPAT.
55 +
56 PYTHON_COMPAT=( ${PYTHON_COMPAT[@]} )
57
58 _python_set_globals() {
59 IUSE=${PYTHON_COMPAT[@]/#/python_targets_}
60 REQUIRED_USE="|| ( ${IUSE} )"
61 +
62 + PYTHON_DEPEND=
63 + local i
64 + for i in ${PYTHON_COMPAT[@]}; do
65 + local d
66 + case ${i} in
67 + python*)
68 + d='dev-lang/python';;
69 + jython*)
70 + d='dev-java/jython';;
71 + pypy*)
72 + d='dev-python/pypy';;
73 + *)
74 + die "Invalid implementation: ${i}"
75 + esac
76 +
77 + local v=${i##*[a-z]}
78 + PYTHON_DEPEND+=" python_targets_${i}? ( ${d}:${v/_/.} )"
79 + done
80 }
81 _python_set_globals
82 --
83 1.7.12

Replies