Gentoo Archives: gentoo-dev

From: Brian Harring <ferringb@×××××.com>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] python-distutils-ng.eclass: allow useflag dependencies for python
Date: Thu, 06 Sep 2012 21:28:50
Message-Id: 20120906212741.GH18495@localhost
In Reply to: [gentoo-dev] python-distutils-ng.eclass: allow useflag dependencies for python by hasufell
1 On Thu, Sep 06, 2012 at 10:44:34PM +0200, hasufell wrote:
2 > I am missing a replacement for PYTHON_USE_WITH.
3 >
4 > Would the attached patch help in any way? Review? Other ideas?
5
6 > --- python-distutils-ng.eclass
7 > +++ python-distutils-ng.eclass
8 > @@ -59,6 +59,25 @@
9 > # Set to any value to disable automatic reinstallation of scripts in bin
10 > # directories. See python-distutils-ng_src_install function.
11 >
12 > +# @ECLASS-VARIABLE: PYTHON_USE
13 > +# @DEFAULT_UNSET
14 > +# @DESCRIPTION:
15 > +# comma seperated list of useflags needed for python
16 > +# this is directly substituted into dev-lang/python[${PYTHON_USE}] thus allowing
17 > +# all valid useflag dependencies
18 > +# example 1: PYTHON_USE="xml,sqlite"
19 > +# example 2: PYTHON_USE="xml?,threads?,-foo"
20 > +
21 > +# @ECLASS-VARIABLE: JYTHON_USE
22 > +# @DEFAULT_UNSET
23 > +# @DESCRIPTION:
24 > +# same as PYTHON_USE just for JYTHON
25 > +
26 > +# @ECLASS-VARIABLE: PYPY_USE
27 > +# @DEFAULT_UNSET
28 > +# @DESCRIPTION:
29 > +# same as PYTHON_USE just for PYPY
30 > +
31 > EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
32 >
33 > case "${EAPI}" in
34 > @@ -107,16 +126,22 @@
35 > fi
36 > unset required_use_str
37 >
38 > +# avoid empty use deps
39 > +[[ -n ${PYTHON_USE} ]] && _PYTHON_USE="[${PYTHON_USE}]" || _PYTHON_USE=""
40 > +[[ -n ${JYTHON_USE} ]] && _JYTHON_USE="[${JYTHON_USE}]" || _JYTHON_USE=""
41 > +[[ -n ${PYPY_USE} ]] && _PYPY_USE="[${PYPY_USE}]" || _PYPY_USE=""
42
43 Ick.
44 _PYTHON_USE="${PYTHON_USE:+[${PYTHON_USE}]}"
45 _JYTHON_USE="${JYTHON_USE:+[${JYTHON_USE}]}"
46 _PYPY_USE="${PYPY_USE:+[${PYPY_USE}]}"
47
48
49
50 > +
51 > +# set python DEPEND and RDEPEND
52 > for impl in ${PYTHON_COMPAT}; do
53 > IUSE+=" python_targets_${impl}"
54 > dep_str="${impl/_/.}"
55 > case "${dep_str}" in
56 > python?.?)
57 > - dep_str="dev-lang/python:${dep_str: -3}" ;;
58 > + dep_str="dev-lang/python:${dep_str: -3}${_PYTHON_USE}" ;;
59 should I ask wth the space is for?
60
61 > jython?.?)
62 > - dep_str="dev-java/jython:${dep_str: -3}" ;;
63 > + dep_str="dev-java/jython:${dep_str: -3}${_JYTHON_USE}" ;;
64 > pypy?.?)
65 > - dep_str="dev-python/pypy:${dep_str: -3}" ;;
66 > + dep_str="dev-python/pypy:${dep_str: -3}${_PYPY_USE}" ;;
67 > *)
68 > die "Unsupported implementation: ${impl}" ;;
69 > esac

Replies