On Thu, 06 Sep 2012 14:22:24 -0400
Ian Stakenvicius <a...@gentoo.org> wrote:

> So one of the advantages of using python-distutils-ng.eclass for
> building (and building against) python modules is that python module
> dependencies can be guaranteed against the same python targets as what
> you're building for, via the PYTHON_TARGETS use expansion.
> 
> Unfortunately, one of the drawbacks to this is that dependencies are
> long and ugly.
> 
> Since in most cases, any python module in *DEPEND is going to have
> python_targets_*? use deps for each implementation in $PYTHON_COMPAT,
> a helper variable that can be substituted for this list would simplify
> the ebuild.

Didn't I think of the same thing some time ago?

> The implementation in the patch below is probably not the best, but I
> propose it as a starting point.
> 
> 
> - --- python-distutils-ng.eclass  2012-06-18 10:53:33.000000000 -0400
> +++ python-distutils-ng.eclass.new      2012-09-06 13:47:28.000000000
> - -0400
> @@ -59,6 +59,22 @@
>  # Set to any value to disable automatic reinstallation of scripts in
>  # bin directories. See python-distutils-ng_src_install function.
> 
> +# @ECLASS-VARIABLE: PTUD

PTUD? Sounds like a verb. Something like 'you should PTUD yourself' ;D.

Not that I'm that brilliant to come up with something good but it
should start with 'PYTHON_', I think, and be explanatory.

> +# @INTERNAL
> +# @DESCRIPTION:
> +# Provides the complete expansion of python_target_ use depedencies
> +# from the content of $PYTHON_COMPAT ; it can be used as a shortform
> +# to set or or append the use deps of complete python-module
> +# dependencies, ie: RDEPEND="dev-python/foo[${PTUD}]"

I think it should spell clearer how the string looks like, i.e. that it
is 'pythonx_y?,pythonx_z?,...'.

> +
> +mysep=
> +PTUD=
> +for impl in ${PYTHON_COMPAT} ; do
> +  PTUD+="${mysep}python_targets_${impl}?"
> +  mysep=","
> +done
> +unset mysep
> +

Nice hack with that mysep but I don't like it, sorry. I'd rather avoid
temporary variables here, or use a function and a 'local' variable.
Calling a function in global scope shouldn't be that bad.

or just something like:

  PTUD=${PYTHON_COMPAT// /?,}?

But then you would have to 'clean up' PYTHON_COMPAT first to avoid
non-space whitespace and so on.

>  EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test
> [Snip!]
> 
>  case "${EAPI}" in

Er, that thing should go after EAPI check.      

-- 
Best regards,
Michał Górny

Attachment: signature.asc
Description: PGP signature

Reply via email to