public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] python-distutils-ng.eclass: allow useflag dependencies for python
@ 2012-09-06 20:44 hasufell
  2012-09-06 20:58 ` Michał Górny
  2012-09-06 21:27 ` Brian Harring
  0 siblings, 2 replies; 6+ messages in thread
From: hasufell @ 2012-09-06 20:44 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 112 bytes --]

I am missing a replacement for PYTHON_USE_WITH.

Would the attached patch help in any way? Review? Other ideas?

[-- Attachment #2: python-distutils-ng.eclass.patch --]
[-- Type: text/x-patch, Size: 1723 bytes --]

--- python-distutils-ng.eclass
+++ python-distutils-ng.eclass
@@ -59,6 +59,25 @@
 # Set to any value to disable automatic reinstallation of scripts in bin
 # directories. See python-distutils-ng_src_install function.
 
+# @ECLASS-VARIABLE: PYTHON_USE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# comma seperated list of useflags needed for python
+# this is directly substituted into dev-lang/python[${PYTHON_USE}] thus allowing
+# all valid useflag dependencies
+# example 1: PYTHON_USE="xml,sqlite"
+# example 2: PYTHON_USE="xml?,threads?,-foo"
+
+# @ECLASS-VARIABLE: JYTHON_USE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# same as PYTHON_USE just for JYTHON
+
+# @ECLASS-VARIABLE: PYPY_USE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# same as PYTHON_USE just for PYPY
+
 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
 
 case "${EAPI}" in
@@ -107,16 +126,22 @@
 fi
 unset required_use_str
 
+# avoid empty use deps
+[[ -n ${PYTHON_USE} ]] && _PYTHON_USE="[${PYTHON_USE}]" || _PYTHON_USE=""
+[[ -n ${JYTHON_USE} ]] && _JYTHON_USE="[${JYTHON_USE}]" || _JYTHON_USE=""
+[[ -n ${PYPY_USE} ]] && _PYPY_USE="[${PYPY_USE}]" || _PYPY_USE=""
+
+# set python DEPEND and RDEPEND
 for impl in ${PYTHON_COMPAT}; do
 	IUSE+=" python_targets_${impl}"
 	dep_str="${impl/_/.}"
 	case "${dep_str}" in
 		python?.?)
-			dep_str="dev-lang/python:${dep_str: -3}" ;;
+			dep_str="dev-lang/python:${dep_str: -3}${_PYTHON_USE}" ;;
 		jython?.?)
-			dep_str="dev-java/jython:${dep_str: -3}" ;;
+			dep_str="dev-java/jython:${dep_str: -3}${_JYTHON_USE}" ;;
 		pypy?.?)
-			dep_str="dev-python/pypy:${dep_str: -3}" ;;
+			dep_str="dev-python/pypy:${dep_str: -3}${_PYPY_USE}" ;;
 		*)
 			die "Unsupported implementation: ${impl}" ;;
 	esac

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] python-distutils-ng.eclass: allow useflag dependencies for python
  2012-09-06 20:44 [gentoo-dev] python-distutils-ng.eclass: allow useflag dependencies for python hasufell
@ 2012-09-06 20:58 ` Michał Górny
  2012-09-08 13:04   ` hasufell
  2012-09-06 21:27 ` Brian Harring
  1 sibling, 1 reply; 6+ messages in thread
From: Michał Górny @ 2012-09-06 20:58 UTC (permalink / raw
  To: gentoo-dev; +Cc: hasufell

[-- Attachment #1: Type: text/plain, Size: 2134 bytes --]

On Thu, 06 Sep 2012 22:44:34 +0200
hasufell <hasufell@gentoo.org> wrote:

> --- python-distutils-ng.eclass
> +++ python-distutils-ng.eclass
> @@ -59,6 +59,25 @@
>  # Set to any value to disable automatic reinstallation of scripts in
> bin # directories. See python-distutils-ng_src_install function.
>  
> +# @ECLASS-VARIABLE: PYTHON_USE
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# comma seperated list of useflags needed for python
> +# this is directly substituted into dev-lang/python[${PYTHON_USE}]
> thus allowing +# all valid useflag dependencies
> +# example 1: PYTHON_USE="xml,sqlite"
> +# example 2: PYTHON_USE="xml?,threads?,-foo"
> +
> +# @ECLASS-VARIABLE: JYTHON_USE
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# same as PYTHON_USE just for JYTHON
> +
> +# @ECLASS-VARIABLE: PYPY_USE
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# same as PYTHON_USE just for PYPY
> +

Why I feel like we're close to PYTHON2_USE, PYTHON3_USE,
PYTHON3NG_USE...

>  EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test
> src_install 
>  case "${EAPI}" in
> @@ -107,16 +126,22 @@
>  fi
>  unset required_use_str
>  
> +# avoid empty use deps
> +[[ -n ${PYTHON_USE} ]] && _PYTHON_USE="[${PYTHON_USE}]" ||
> _PYTHON_USE="" +[[ -n ${JYTHON_USE} ]] &&
> _JYTHON_USE="[${JYTHON_USE}]" || _JYTHON_USE="" +[[ -n ${PYPY_USE} ]]
> && _PYPY_USE="[${PYPY_USE}]" || _PYPY_USE="" +
> +# set python DEPEND and RDEPEND
>  for impl in ${PYTHON_COMPAT}; do
>  	IUSE+=" python_targets_${impl}"
>  	dep_str="${impl/_/.}"
>  	case "${dep_str}" in
>  		python?.?)
> -			dep_str="dev-lang/python:${dep_str: -3}" ;;
> +			dep_str="dev-lang/python:${dep_str:
> -3}${_PYTHON_USE}" ;; jython?.?)
> -			dep_str="dev-java/jython:${dep_str: -3}" ;;
> +			dep_str="dev-java/jython:${dep_str:
> -3}${_JYTHON_USE}" ;; pypy?.?)
> -			dep_str="dev-python/pypy:${dep_str: -3}" ;;
> +			dep_str="dev-python/pypy:${dep_str:
> -3}${_PYPY_USE}" ;; *)
>  			die "Unsupported implementation: ${impl}" ;;
>  	esac

I have to think more about this.

Where are your use cases?

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 316 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] python-distutils-ng.eclass: allow useflag dependencies for python
  2012-09-06 20:44 [gentoo-dev] python-distutils-ng.eclass: allow useflag dependencies for python hasufell
  2012-09-06 20:58 ` Michał Górny
@ 2012-09-06 21:27 ` Brian Harring
  2012-09-06 23:08   ` [gentoo-dev] " Jonathan Callen
  1 sibling, 1 reply; 6+ messages in thread
From: Brian Harring @ 2012-09-06 21:27 UTC (permalink / raw
  To: gentoo-dev

On Thu, Sep 06, 2012 at 10:44:34PM +0200, hasufell wrote:
> I am missing a replacement for PYTHON_USE_WITH.
> 
> Would the attached patch help in any way? Review? Other ideas?

> --- python-distutils-ng.eclass
> +++ python-distutils-ng.eclass
> @@ -59,6 +59,25 @@
>  # Set to any value to disable automatic reinstallation of scripts in bin
>  # directories. See python-distutils-ng_src_install function.
>  
> +# @ECLASS-VARIABLE: PYTHON_USE
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# comma seperated list of useflags needed for python
> +# this is directly substituted into dev-lang/python[${PYTHON_USE}] thus allowing
> +# all valid useflag dependencies
> +# example 1: PYTHON_USE="xml,sqlite"
> +# example 2: PYTHON_USE="xml?,threads?,-foo"
> +
> +# @ECLASS-VARIABLE: JYTHON_USE
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# same as PYTHON_USE just for JYTHON
> +
> +# @ECLASS-VARIABLE: PYPY_USE
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# same as PYTHON_USE just for PYPY
> +
>  EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
>  
>  case "${EAPI}" in
> @@ -107,16 +126,22 @@
>  fi
>  unset required_use_str
>  
> +# avoid empty use deps
> +[[ -n ${PYTHON_USE} ]] && _PYTHON_USE="[${PYTHON_USE}]" || _PYTHON_USE=""
> +[[ -n ${JYTHON_USE} ]] && _JYTHON_USE="[${JYTHON_USE}]" || _JYTHON_USE=""
> +[[ -n ${PYPY_USE} ]] && _PYPY_USE="[${PYPY_USE}]" || _PYPY_USE=""

Ick.
_PYTHON_USE="${PYTHON_USE:+[${PYTHON_USE}]}"
_JYTHON_USE="${JYTHON_USE:+[${JYTHON_USE}]}"
_PYPY_USE="${PYPY_USE:+[${PYPY_USE}]}"



> +
> +# set python DEPEND and RDEPEND
>  for impl in ${PYTHON_COMPAT}; do
>  	IUSE+=" python_targets_${impl}"
>  	dep_str="${impl/_/.}"
>  	case "${dep_str}" in
>  		python?.?)
> -			dep_str="dev-lang/python:${dep_str: -3}" ;;
> +			dep_str="dev-lang/python:${dep_str: -3}${_PYTHON_USE}" ;;
should I ask wth the space is for?

>  		jython?.?)
> -			dep_str="dev-java/jython:${dep_str: -3}" ;;
> +			dep_str="dev-java/jython:${dep_str: -3}${_JYTHON_USE}" ;;
>  		pypy?.?)
> -			dep_str="dev-python/pypy:${dep_str: -3}" ;;
> +			dep_str="dev-python/pypy:${dep_str: -3}${_PYPY_USE}" ;;
>  		*)
>  			die "Unsupported implementation: ${impl}" ;;
>  	esac



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [gentoo-dev] Re: python-distutils-ng.eclass: allow useflag dependencies for python
  2012-09-06 21:27 ` Brian Harring
@ 2012-09-06 23:08   ` Jonathan Callen
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Callen @ 2012-09-06 23:08 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 09/06/2012 05:27 PM, Brian Harring wrote:
> On Thu, Sep 06, 2012 at 10:44:34PM +0200, hasufell wrote:
>> -			dep_str="dev-lang/python:${dep_str: -3}" ;; + 
>> dep_str="dev-lang/python:${dep_str: -3}${_PYTHON_USE}" ;;
> should I ask wth the space is for?
> 

Without the space, ${dep_str:-3} means "${dep_str} unless empty or
unset, otherwise 3"; with the space, ${dep_str: -3} (can also be
written ${dep_str:(-3)}) means "the last 3 characters of ${dep_str}".
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQIcBAEBCgAGBQJQSSzXAAoJELHSF2kinlg4UMUP/1xlAEhmy9JfDp//IPssBZ6g
SsO1eNbPjFtU8bFAWDAcbCMQ4c4bYB7xeAYCwn90qccpYiyOqftWCRiF5CPdou0T
ntUp2dpPkps1NkuuxSEwfk2jr91s38ri8GA3WOlT4AjADhjjjpIQjn7ib9SVYKVj
ZywHrwxjpHlkR7SaALAriwg6hkkrdtNKVtqnWyGKfx570e0rGJk+EK5SbnwtzHaD
ttmKkSFcHrkyPamTrmLa2udjqnnVMi0wuRi8IC5NP5AgF3osj91fqq1waBpViXxL
UVB397OpsHwXxP5uAWJ6O8eFPviCq8HcstRCg+XXnBIdyQYQcVB80aA+r+kfqfjI
d2WGBS5wNwYILGW1L5S5z5tcGibJKkraCvwI2vhNYItzL43X2oBuuiwVKo7u0cd2
P04g3vwBAfcMvGKo/GFWyUGvsLrdl9Fcnmiyv86XvJSo8guhx0NO628x/4uFY+uU
/IsbgXcWCC48HLmLqypE+kBVofkR7nWGNecEvHlgTe/4oLzpyJzOj/5bgTUbioW+
w9Rj/0S3K/GOYYfbBjvsQKH3vSuYqPP2/6KuG5N/r98lCtkaRujfxj7t7NlSqRT0
1XGr9Y+YZlE6YBQ/JjrfsOH9uotohvutY2aIxUlfe1MFjbixI3Q7p/9EWaZ89Cwq
8saYFqjaWfe9lHmwxxbJ
=x+TM
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] python-distutils-ng.eclass: allow useflag dependencies for python
  2012-09-06 20:58 ` Michał Górny
@ 2012-09-08 13:04   ` hasufell
  2012-09-08 18:36     ` Michał Górny
  0 siblings, 1 reply; 6+ messages in thread
From: hasufell @ 2012-09-08 13:04 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

> Where are your use cases?

qgrep PYTHON_USE_WITH
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJQS0J1AAoJEFpvPKfnPDWzktAH/jY5/hfkIv6Gn+mRBg3ROtKh
EQ0vAJV3ZXSsIlO7UOxJf79wj1TqiApAhXvUxs5orJKOuCqc3Pfq41KNV/KfyRiS
zno/4sSVvgU6udSGx3BScbDIQi6T7bQKquP3FalDw30v2/xDqYdTPFCx+qfRG0Eu
erquQOiMs2OzBBzQn95xnjGaWN7Z9QBmkdIS3pC4hB2hIGOQmBEskRCQVtA9mfog
wM5war7DpTUsyrcJb67LZy0AeACN42xHJ7KFMkqVYp1WkT7Y04LmWmCjUJfSK7Yt
osZ2r/SUpCHQ1cJ5LM5DunboV7j2DZGzyNvCM2N3phnfYbQWAxhWoI4Idc4YzqE=
=KICW
-----END PGP SIGNATURE-----


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [gentoo-dev] python-distutils-ng.eclass: allow useflag dependencies for python
  2012-09-08 13:04   ` hasufell
@ 2012-09-08 18:36     ` Michał Górny
  0 siblings, 0 replies; 6+ messages in thread
From: Michał Górny @ 2012-09-08 18:36 UTC (permalink / raw
  To: gentoo-dev; +Cc: hasufell

[-- Attachment #1: Type: text/plain, Size: 289 bytes --]

On Sat, 08 Sep 2012 15:04:53 +0200
hasufell <hasufell@gentoo.org> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> > Where are your use cases?
> 
> qgrep PYTHON_USE_WITH

That gives more cases than your solution can handle...

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 316 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-09-08 18:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-06 20:44 [gentoo-dev] python-distutils-ng.eclass: allow useflag dependencies for python hasufell
2012-09-06 20:58 ` Michał Górny
2012-09-08 13:04   ` hasufell
2012-09-08 18:36     ` Michał Górny
2012-09-06 21:27 ` Brian Harring
2012-09-06 23:08   ` [gentoo-dev] " Jonathan Callen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox