Gentoo Archives: gentoo-python

From: Mike Gilbert <floppym@g.o>
To: gentoo-python@l.g.o
Subject: Re: [gentoo-python] Concept for optional Python dependency and USE-flag deps in p-d-ng
Date: Sun, 09 Sep 2012 15:22:04
Message-Id: CAJ0EP42LH905tBF5WY7D+xDNBueWZ+u9AMuWuKGGAACYYqc76g@mail.gmail.com
In Reply to: [gentoo-python] Concept for optional Python dependency and USE-flag deps in p-d-ng by "Michał Górny"
1 On Sun, Sep 9, 2012 at 4:33 AM, Michał Górny <mgorny@g.o> wrote:
2 > Hello,
3 >
4 > After some thinking, I think I found an optimal solution to
5 > implementing various kinds of Python dependencies and PYTHON_USE_WITH*.
6 >
7 > As a note, all variable names are dirty and not official. Feel free to
8 > suggest better ones.
9 >
10 > 1. Add a user-defined variable PYTHON_USE. If user needed any specific
11 > flags from a Python dependency, he can set the USE dependency string
12 > there. The string will have to follow the general rules for USE
13 > dependencies and be correct for every Python implementation specified
14 > in PYTHON_COMPAT (this may require USE defaults). For example:
15 >
16 > PYTHON_USE="ncurses,sqlite"
17 >
18 > 2. Add a eclass-defined variable PYTHON_DEPEND. It will be always
19 > exported, and contain a dependency string created using PYTHON_COMPAT
20 > and PYTHON_USE -- the most simple and most common one, e.g.:
21 >
22 > PYTHON_DEPEND="
23 > python_targets_pythonX_Y?
24 > ( dev-python/python:X.Y[ncurses,sqlite] )
25 > "
26 >
27 > 3. By default, just append PYTHON_DEPEND to DEPEND and RDEPEND. Provide
28 > an option to disable that. If user wants optional Python, he can
29 > disable it and use ${PYTHON_DEPEND} in his own *DEPEND code. (we could
30 > also provide a quick switch to add 'python? ( )' or '$USEFLAG? ( )').
31 >
32
33 I like the idea of the PYTHON_DEPEND variable and the option to
34 disable its addition to DEPEND and RDEPEND. That makes it simple to
35 control for packages which only need python for building, for example.
36
37 I don't think we really need the switch you mention for controlling
38 optional python dependencies, but I guess it couldn't hurt.
39
40 > 4. Finally, provide a general, parametrized dependency generator
41 > function which will be useful in all the remaining non-common cases
42 > which can't be handled sanely by any other solution.
43 >
44
45 Sounds good to me. We should hash out exactly what parameters it would
46 take; hopefully we can make it flexible enough to deal with changes in
47 dependency atoms in future EAPIs.
48
49 As I interpret your example, your hypothetical function takes a list
50 of use flags as $1, and the rest of the parameters are python targets.
51 Maybe we should put the use flag list behind a switch? I'm mainly
52 thinking of scenarios where various python implementations support
53 different use flags.

Replies