1 |
On Thu, 06 Sep 2012 14:22:24 -0400 |
2 |
Ian Stakenvicius <axs@g.o> wrote: |
3 |
|
4 |
> So one of the advantages of using python-distutils-ng.eclass for |
5 |
> building (and building against) python modules is that python module |
6 |
> dependencies can be guaranteed against the same python targets as what |
7 |
> you're building for, via the PYTHON_TARGETS use expansion. |
8 |
> |
9 |
> Unfortunately, one of the drawbacks to this is that dependencies are |
10 |
> long and ugly. |
11 |
> |
12 |
> Since in most cases, any python module in *DEPEND is going to have |
13 |
> python_targets_*? use deps for each implementation in $PYTHON_COMPAT, |
14 |
> a helper variable that can be substituted for this list would simplify |
15 |
> the ebuild. |
16 |
|
17 |
Didn't I think of the same thing some time ago? |
18 |
|
19 |
> The implementation in the patch below is probably not the best, but I |
20 |
> propose it as a starting point. |
21 |
> |
22 |
> |
23 |
> - --- python-distutils-ng.eclass 2012-06-18 10:53:33.000000000 -0400 |
24 |
> +++ python-distutils-ng.eclass.new 2012-09-06 13:47:28.000000000 |
25 |
> - -0400 |
26 |
> @@ -59,6 +59,22 @@ |
27 |
> # Set to any value to disable automatic reinstallation of scripts in |
28 |
> # bin directories. See python-distutils-ng_src_install function. |
29 |
> |
30 |
> +# @ECLASS-VARIABLE: PTUD |
31 |
|
32 |
PTUD? Sounds like a verb. Something like 'you should PTUD yourself' ;D. |
33 |
|
34 |
Not that I'm that brilliant to come up with something good but it |
35 |
should start with 'PYTHON_', I think, and be explanatory. |
36 |
|
37 |
> +# @INTERNAL |
38 |
> +# @DESCRIPTION: |
39 |
> +# Provides the complete expansion of python_target_ use depedencies |
40 |
> +# from the content of $PYTHON_COMPAT ; it can be used as a shortform |
41 |
> +# to set or or append the use deps of complete python-module |
42 |
> +# dependencies, ie: RDEPEND="dev-python/foo[${PTUD}]" |
43 |
|
44 |
I think it should spell clearer how the string looks like, i.e. that it |
45 |
is 'pythonx_y?,pythonx_z?,...'. |
46 |
|
47 |
> + |
48 |
> +mysep= |
49 |
> +PTUD= |
50 |
> +for impl in ${PYTHON_COMPAT} ; do |
51 |
> + PTUD+="${mysep}python_targets_${impl}?" |
52 |
> + mysep="," |
53 |
> +done |
54 |
> +unset mysep |
55 |
> + |
56 |
|
57 |
Nice hack with that mysep but I don't like it, sorry. I'd rather avoid |
58 |
temporary variables here, or use a function and a 'local' variable. |
59 |
Calling a function in global scope shouldn't be that bad. |
60 |
|
61 |
or just something like: |
62 |
|
63 |
PTUD=${PYTHON_COMPAT// /?,}? |
64 |
|
65 |
But then you would have to 'clean up' PYTHON_COMPAT first to avoid |
66 |
non-space whitespace and so on. |
67 |
|
68 |
> EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test |
69 |
> [Snip!] |
70 |
> |
71 |
> case "${EAPI}" in |
72 |
|
73 |
Er, that thing should go after EAPI check. |
74 |
|
75 |
-- |
76 |
Best regards, |
77 |
Michał Górny |