Gentoo Archives: gentoo-dev

From: Ben de Groot <yngwin@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH 1/3] Generate python depstrings in python-r1 (updated).
Date: Sat, 22 Sep 2012 04:48:26
Message-Id: CAB9SyzQieT16BNvPnqNzJcdnbFRVgCrB9rYjay7utpx7oX2aFg@mail.gmail.com
In Reply to: [gentoo-dev] [PATCH 1/3] Generate python depstrings in python-r1 (updated). by "Michał Górny"
1 On 20 September 2012 05:43, Michał Górny <mgorny@g.o> wrote:
2 > I've renamed PYTHON_DEPEND to avoid confusion with python.eclass.
3 > ---
4 > gx86/eclass/python-distutils-ng.eclass | 20 ++-----------------
5 > gx86/eclass/python-r1.eclass | 35 ++++++++++++++++++++++++++++++++--
6 > 2 files changed, 35 insertions(+), 20 deletions(-)
7 >
8 > diff --git a/gx86/eclass/python-distutils-ng.eclass b/gx86/eclass/python-distutils-ng.eclass
9 > index 5df965c..34717aa 100644
10 > --- a/gx86/eclass/python-distutils-ng.eclass
11 > +++ b/gx86/eclass/python-distutils-ng.eclass
12 > @@ -74,24 +74,8 @@ _python-distutils-ng_get_binary_for_implementation() {
13 > esac
14 > }
15 >
16 > -for impl in ${PYTHON_COMPAT[@]}; do
17 > - dep_str="${impl/_/.}"
18 > - case "${dep_str}" in
19 > - python?.?)
20 > - dep_str="dev-lang/python:${dep_str: -3}" ;;
21 > - jython?.?)
22 > - dep_str="dev-java/jython:${dep_str: -3}" ;;
23 > - pypy?.?)
24 > - dep_str="dev-python/pypy:${dep_str: -3}" ;;
25 > - *)
26 > - die "Unsupported implementation: ${impl}" ;;
27 > - esac
28 > - dep_str="python_targets_${impl}? ( ${dep_str} )"
29 > -
30 > - RDEPEND="${RDEPEND} ${dep_str}"
31 > - DEPEND="${DEPEND} ${dep_str}"
32 > - unset dep_str
33 > -done
34 > +RDEPEND=${PYTHON_DEPS}
35 > +DEPEND=${PYTHON_DEPS}
36 >
37 > _PACKAGE_SPECIFIC_S="${S#${WORKDIR}/}"
38 >
39 > diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
40 > index 18f9246..957db68 100644
41 > --- a/gx86/eclass/python-r1.eclass
42 > +++ b/gx86/eclass/python-r1.eclass
43 > @@ -40,14 +40,45 @@ _PYTHON_ALL_IMPLS=(
44 > # a package supports. It must be set before the `inherit' call.
45 > # The default is to enable all implementations.
46 > #
47 > -# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar, the eclass
48 > -# will implicitly convert it to an array.
49 > +# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar,
50 > +# the eclass will implicitly convert it to an array.
51 > : ${PYTHON_COMPAT:=${_PYTHON_ALL_IMPLS[@]}}
52 >
53 > +# @ECLASS-VARIABLE: PYTHON_DEPS
54 > +# @DESCRIPTION:
55 > +# This is an eclass-generated Python dependency string for all
56 > +# implementations listed in PYTHON_COMPAT. It should be used
57 > +# in RDEPEND and/or DEPEND like:
58 > +#
59 > +# @CODE
60 > +# RDEPEND="${PYTHON_DEPS}
61 > +# dev-foo/mydep"
62 > +# DEPEND="${RDEPEND}"
63 > +# @CODE
64 > +
65 > PYTHON_COMPAT=( ${PYTHON_COMPAT[@]} )
66 >
67 > _python_set_globals() {
68 > IUSE=${PYTHON_COMPAT[@]/#/python_targets_}
69 > REQUIRED_USE="|| ( ${IUSE} )"
70 > +
71 > + PYTHON_DEPS=
72 > + local i
73 > + for i in ${PYTHON_COMPAT[@]}; do
74 > + local d
75 > + case ${i} in
76 > + python*)
77 > + d='dev-lang/python';;
78 > + jython*)
79 > + d='dev-java/jython';;
80 > + pypy*)
81 > + d='dev-python/pypy';;
82 > + *)
83 > + die "Invalid implementation: ${i}"
84 > + esac
85 > +
86 > + local v=${i##*[a-z]}
87 > + PYTHON_DEPS+=" python_targets_${i}? ( ${d}:${v/_/.} )"
88 > + done
89 > }
90 > _python_set_globals
91 > --
92 > 1.7.12
93 >
94 >
95
96 This patchset looks good to me.
97
98 --
99 Cheers,
100
101 Ben | yngwin
102 Gentoo developer
103 Gentoo Qt project lead, Gentoo Wiki admin