public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-python] [PATCH] Eclass support for pypy-bin
@ 2013-07-22  9:49 Michał Górny
  2013-07-22  9:50 ` [gentoo-python] [PATCH 1/6] [python-any-r1] use PYTHON_PKG_DEP for generating deps Michał Górny
                   ` (6 more replies)
  0 siblings, 7 replies; 10+ messages in thread
From: Michał Górny @ 2013-07-22  9:49 UTC (permalink / raw
  To: gentoo-python

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

Hello,

Since we're practically ready to start building pypy-bin packages, we
should address the compatibility within eclasses.

I'm sending six patches that fix all the Python eclasses (-r1, -ng
and the old one) to support pypy-bin. It should be noted that some
ebuilds which use ugly unsupported hackery (sys-apps/portage) will
still need to be updated by hand.

And all users who had pypy enabled before will need to rebuild all
the packages that depend on it, or hack their *DEPEND in vardb to allow
pypy-bin.

Patches will be sent as replies to this mail. Short summary follows.


python-any-r1.eclass:

1) use PYTHON_PKG_DEP for generating deps

I must have missed it when converting the other two eclasses.

2) replace has_version with simple '-x' check

That makes it simpler, faster and compatible with PYTHON_PKG_DEP
becoming any-of dep.


python-utils-r1.eclass:

3) simple reordering of PYTHON_PKG_DEP

4) generate any-of dep for || ( pypy pypy-bin )

Which basically makes all the eclasses compatible.


python-distutils-ng.eclass:

5) add any-of dep to *DEPEND.

Although it's doomed, it's fairly easy to add the support to it.


python.eclass:

6) hack python_get_implementation_package() for pypy-bin

It's not used anywhere but in the eclass itself. It's used solely for
passing into 'has_version' to do integrity checks or PYTHON_USE_WITH
checks in ancient EAPIs.

I don't think it's worth to address this deprecated eclass thoroughly.
Therefore, the patch just uses has_version to see if pypy-bin is
installed, and outputs 'pypy-bin' or 'pypy' atom appropriately.

Also, I don't see any place outputting pypy dep. I guess it just
doesn't do it.

-- 
Best regards,
Michał Górny

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

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

* [gentoo-python] [PATCH 1/6] [python-any-r1] use PYTHON_PKG_DEP for generating deps.
  2013-07-22  9:49 [gentoo-python] [PATCH] Eclass support for pypy-bin Michał Górny
@ 2013-07-22  9:50 ` Michał Górny
  2013-07-27  9:39   ` Michał Górny
  2013-07-22  9:51 ` [gentoo-python] [PATCH 2/6] [python-any-r1] do not use has_version() for interpreter checks Michał Górny
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Michał Górny @ 2013-07-22  9:50 UTC (permalink / raw
  To: gentoo-python; +Cc: Michał Górny

I must have missed it when converting the other two eclasses.
---
 gx86/eclass/python-any-r1.eclass | 24 ++++++------------------
 1 file changed, 6 insertions(+), 18 deletions(-)

diff --git a/gx86/eclass/python-any-r1.eclass b/gx86/eclass/python-any-r1.eclass
index 087efb2..aa11cf7 100644
--- a/gx86/eclass/python-any-r1.eclass
+++ b/gx86/eclass/python-any-r1.eclass
@@ -118,27 +118,15 @@ _python_build_set_globals() {
 	[[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]"
 
 	PYTHON_DEPS=
-	local i
+	local i PYTHON_PKG_DEP
 	for i in "${_PYTHON_ALL_IMPLS[@]}"; do
-		if has "${i}" "${PYTHON_COMPAT[@]}"
-		then
-			local d
-			case ${i} in
-				python*)
-					d='dev-lang/python';;
-				jython*)
-					d='dev-java/jython';;
-				pypy*)
-					d='dev-python/pypy';;
-				*)
-					die "Invalid implementation: ${i}"
-			esac
+		has "${i}" "${PYTHON_COMPAT[@]}" || continue
 
-			local v=${i##*[a-z]}
-			PYTHON_DEPS="${d}:${v/_/.}${usestr} ${PYTHON_DEPS}"
-		fi
+		python_export "${i}" PYTHON_PKG_DEP
+
+		PYTHON_DEPS="${PYTHON_PKG_DEP} ${PYTHON_DEPS}"
 	done
-	PYTHON_DEPS="|| ( ${PYTHON_DEPS})"
+	PYTHON_DEPS="|| ( ${PYTHON_DEPS} )"
 }
 _python_build_set_globals
 
-- 
1.8.3.2



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

* [gentoo-python] [PATCH 2/6] [python-any-r1] do not use has_version() for interpreter checks.
  2013-07-22  9:49 [gentoo-python] [PATCH] Eclass support for pypy-bin Michał Górny
  2013-07-22  9:50 ` [gentoo-python] [PATCH 1/6] [python-any-r1] use PYTHON_PKG_DEP for generating deps Michał Górny
@ 2013-07-22  9:51 ` Michał Górny
  2013-07-27  9:45   ` Michał Górny
  2013-07-22  9:51 ` [gentoo-python] [PATCH 3/6] [python-utils-r1] Reorder PYTHON_PKG_DEP gen Michał Górny
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 10+ messages in thread
From: Michał Górny @ 2013-07-22  9:51 UTC (permalink / raw
  To: gentoo-python; +Cc: Michał Górny

has_version() can't handle any-of deps, and I see no point in
introducing special magic to handle pypy-bin there. Instead, just check
if the interpreter executable is installed. It is simpler and faster
this way.
---
 gx86/eclass/python-any-r1.eclass | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gx86/eclass/python-any-r1.eclass b/gx86/eclass/python-any-r1.eclass
index aa11cf7..b392453 100644
--- a/gx86/eclass/python-any-r1.eclass
+++ b/gx86/eclass/python-any-r1.eclass
@@ -176,9 +176,10 @@ _python_EPYTHON_supported() {
 	esac
 
 	if has "${i}" "${PYTHON_COMPAT[@]}"; then
-		local PYTHON_PKG_DEP
-		python_export "${i}" PYTHON_PKG_DEP
-		if ROOT=/ has_version "${PYTHON_PKG_DEP}"; then
+		local PYTHON
+		python_export PYTHON
+
+		if [[ -x ${PYTHON} ]]; then
 			if declare -f python_check_deps >/dev/null; then
 				local PYTHON_USEDEP="python_targets_${i}(-),python_single_target_${i}(+)"
 				python_check_deps
-- 
1.8.3.2



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

* [gentoo-python] [PATCH 3/6] [python-utils-r1] Reorder PYTHON_PKG_DEP gen.
  2013-07-22  9:49 [gentoo-python] [PATCH] Eclass support for pypy-bin Michał Górny
  2013-07-22  9:50 ` [gentoo-python] [PATCH 1/6] [python-any-r1] use PYTHON_PKG_DEP for generating deps Michał Górny
  2013-07-22  9:51 ` [gentoo-python] [PATCH 2/6] [python-any-r1] do not use has_version() for interpreter checks Michał Górny
@ 2013-07-22  9:51 ` Michał Górny
  2013-07-22  9:51 ` [gentoo-python] [PATCH 4/6] [python-utils-r1] Support pypy-bin in PYTHON_PKG_DEP Michał Górny
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Michał Górny @ 2013-07-22  9:51 UTC (permalink / raw
  To: gentoo-python; +Cc: Michał Górny

Prepare the suffix first, and append it to individual deps. This will
make adding pypy-bin a piece of cake.
---
 gx86/eclass/python-utils-r1.eclass | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass
index 3565879..4450618 100644
--- a/gx86/eclass/python-utils-r1.eclass
+++ b/gx86/eclass/python-utils-r1.eclass
@@ -336,26 +336,27 @@ python_export() {
 				debug-print "${FUNCNAME}: PYTHON_LIBS = ${PYTHON_LIBS}"
 				;;
 			PYTHON_PKG_DEP)
-				local d
+				local suffix
+
+				# slot
+				suffix=:${impl##*[a-z-]}
+
+				# use-dep
+				if [[ ${PYTHON_REQ_USE} ]]; then
+					suffix+="[${PYTHON_REQ_USE}]"
+				fi
+
 				case ${impl} in
 					python*)
-						PYTHON_PKG_DEP='dev-lang/python';;
+						PYTHON_PKG_DEP="dev-lang/python${suffix}";;
 					jython*)
-						PYTHON_PKG_DEP='dev-java/jython';;
+						PYTHON_PKG_DEP="dev-java/jython${suffix}";;
 					pypy*)
-						PYTHON_PKG_DEP='dev-python/pypy';;
+						PYTHON_PKG_DEP="dev-python/pypy${suffix}";;
 					*)
 						die "Invalid implementation: ${impl}"
 				esac
 
-				# slot
-				PYTHON_PKG_DEP+=:${impl##*[a-z-]}
-
-				# use-dep
-				if [[ ${PYTHON_REQ_USE} ]]; then
-					PYTHON_PKG_DEP+=[${PYTHON_REQ_USE}]
-				fi
-
 				export PYTHON_PKG_DEP
 				debug-print "${FUNCNAME}: PYTHON_PKG_DEP = ${PYTHON_PKG_DEP}"
 				;;
-- 
1.8.3.2



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

* [gentoo-python] [PATCH 4/6] [python-utils-r1] Support pypy-bin in PYTHON_PKG_DEP.
  2013-07-22  9:49 [gentoo-python] [PATCH] Eclass support for pypy-bin Michał Górny
                   ` (2 preceding siblings ...)
  2013-07-22  9:51 ` [gentoo-python] [PATCH 3/6] [python-utils-r1] Reorder PYTHON_PKG_DEP gen Michał Górny
@ 2013-07-22  9:51 ` Michał Górny
  2013-07-22  9:51 ` [gentoo-python] [PATCH 5/6] [python-distutils-ng] Support pypy-bin Michał Górny
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 10+ messages in thread
From: Michał Górny @ 2013-07-22  9:51 UTC (permalink / raw
  To: gentoo-python; +Cc: Michał Górny

Use || ( dev-python/pypy dev-python/pypy-bin ) to support both packages.
No ebuild uses PYTHON_PKG_DEP so it's fine to change it into any-of dep.
---
 gx86/eclass/python-utils-r1.eclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass
index 4450618..b58f3c9 100644
--- a/gx86/eclass/python-utils-r1.eclass
+++ b/gx86/eclass/python-utils-r1.eclass
@@ -352,7 +352,8 @@ python_export() {
 					jython*)
 						PYTHON_PKG_DEP="dev-java/jython${suffix}";;
 					pypy*)
-						PYTHON_PKG_DEP="dev-python/pypy${suffix}";;
+						PYTHON_PKG_DEP="|| ( dev-python/pypy${suffix}
+							dev-python/pypy-bin${suffix} )";;
 					*)
 						die "Invalid implementation: ${impl}"
 				esac
-- 
1.8.3.2



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

* [gentoo-python] [PATCH 5/6] [python-distutils-ng] Support pypy-bin.
  2013-07-22  9:49 [gentoo-python] [PATCH] Eclass support for pypy-bin Michał Górny
                   ` (3 preceding siblings ...)
  2013-07-22  9:51 ` [gentoo-python] [PATCH 4/6] [python-utils-r1] Support pypy-bin in PYTHON_PKG_DEP Michał Górny
@ 2013-07-22  9:51 ` Michał Górny
  2013-07-22  9:51 ` [gentoo-python] [PATCH 6/6] [python.eclass] Support pypy-bin in python_get_implement Michał Górny
  2013-07-27 11:22 ` [gentoo-python] [PATCH] Eclass support for pypy-bin Michał Górny
  6 siblings, 0 replies; 10+ messages in thread
From: Michał Górny @ 2013-07-22  9:51 UTC (permalink / raw
  To: gentoo-python; +Cc: Michał Górny

---
 gx86/eclass/python-distutils-ng.eclass | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gx86/eclass/python-distutils-ng.eclass b/gx86/eclass/python-distutils-ng.eclass
index 249757f..6018913 100644
--- a/gx86/eclass/python-distutils-ng.eclass
+++ b/gx86/eclass/python-distutils-ng.eclass
@@ -132,7 +132,8 @@ for impl in ${PYTHON_COMPAT}; do
 		jython?.?)
 			dep_str="dev-java/jython:${dep_str: -3}${_PYTHON_USE}" ;;
 		pypy?.?)
-			dep_str="dev-python/pypy:${dep_str: -3}${_PYTHON_USE}" ;;
+			dep_str="|| ( dev-python/pypy:${dep_str: -3}${_PYTHON_USE}
+				dev-python/pypy-bin:${dep_str: -3}${_PYTHON_USE} )" ;;
 		*)
 			die "Unsupported implementation: ${impl}" ;;
 	esac
-- 
1.8.3.2



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

* [gentoo-python] [PATCH 6/6] [python.eclass] Support pypy-bin in python_get_implement...
  2013-07-22  9:49 [gentoo-python] [PATCH] Eclass support for pypy-bin Michał Górny
                   ` (4 preceding siblings ...)
  2013-07-22  9:51 ` [gentoo-python] [PATCH 5/6] [python-distutils-ng] Support pypy-bin Michał Górny
@ 2013-07-22  9:51 ` Michał Górny
  2013-07-27 11:22 ` [gentoo-python] [PATCH] Eclass support for pypy-bin Michał Górny
  6 siblings, 0 replies; 10+ messages in thread
From: Michał Górny @ 2013-07-22  9:51 UTC (permalink / raw
  To: gentoo-python; +Cc: Michał Górny

The python_get_implementational_package() is used solely in the eclass
for integrity checks, and is always passed to 'has_version'. Therefore,
it should be enough to put a has_version hack in it, and output either
dev-python/pypy-bin or dev-python/pypy depending on which of them is
installed.

This eclass is no longer maintained and it seems not to output any
dependencies on pypy packages.
---
 gx86/eclass/python.eclass | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/gx86/eclass/python.eclass b/gx86/eclass/python.eclass
index 3f94e0b..272808b 100644
--- a/gx86/eclass/python.eclass
+++ b/gx86/eclass/python.eclass
@@ -2054,7 +2054,11 @@ python_get_implementational_package() {
 		elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
 			echo "=dev-java/jython-${PYTHON_ABI%-jython}*"
 		elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
-			echo "=dev-python/pypy-${PYTHON_ABI#*-pypy-}*"
+			if has_version "=dev-python/pypy-bin-${PYTHON_ABI#*-pypy-}*"; then
+				echo "=dev-python/pypy-bin-${PYTHON_ABI#*-pypy-}*"
+			else
+				echo "=dev-python/pypy-${PYTHON_ABI#*-pypy-}*"
+			fi
 		fi
 	else
 		if [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "CPython" ]]; then
@@ -2062,7 +2066,11 @@ python_get_implementational_package() {
 		elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "Jython" ]]; then
 			echo "dev-java/jython:${PYTHON_ABI%-jython}"
 		elif [[ "$(_python_get_implementation "${PYTHON_ABI}")" == "PyPy" ]]; then
-			echo "dev-python/pypy:${PYTHON_ABI#*-pypy-}"
+			if has_version "dev-python/pypy-bin:${PYTHON_ABI#*-pypy-}"; then
+				echo "dev-python/pypy-bin:${PYTHON_ABI#*-pypy-}"
+			else
+				echo "dev-python/pypy:${PYTHON_ABI#*-pypy-}"
+			fi
 		fi
 	fi
 }
-- 
1.8.3.2



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

* Re: [gentoo-python] [PATCH 1/6] [python-any-r1] use PYTHON_PKG_DEP for generating deps.
  2013-07-22  9:50 ` [gentoo-python] [PATCH 1/6] [python-any-r1] use PYTHON_PKG_DEP for generating deps Michał Górny
@ 2013-07-27  9:39   ` Michał Górny
  0 siblings, 0 replies; 10+ messages in thread
From: Michał Górny @ 2013-07-27  9:39 UTC (permalink / raw
  To: Michał Górny; +Cc: gentoo-python

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

Dnia 2013-07-22, o godz. 11:50:17
Michał Górny <mgorny@gentoo.org> napisał(a):

>  	done
> -	PYTHON_DEPS="|| ( ${PYTHON_DEPS})"
> +	PYTHON_DEPS="|| ( ${PYTHON_DEPS} )"
>  }
>  _python_build_set_globals

marienz noticed that I added the space unintentionally (PYTHON_DEPS
ends with a space). However, at the point I'm wondering if it's not
better to do it like this in all the classes. Although it results
in double space before the closing parenthesis, it is less confusing :).

-- 
Best regards,
Michał Górny

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

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

* Re: [gentoo-python] [PATCH 2/6] [python-any-r1] do not use has_version() for interpreter checks.
  2013-07-22  9:51 ` [gentoo-python] [PATCH 2/6] [python-any-r1] do not use has_version() for interpreter checks Michał Górny
@ 2013-07-27  9:45   ` Michał Górny
  0 siblings, 0 replies; 10+ messages in thread
From: Michał Górny @ 2013-07-27  9:45 UTC (permalink / raw
  To: Michał Górny; +Cc: gentoo-python

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

Dnia 2013-07-22, o godz. 11:51:15
Michał Górny <mgorny@gentoo.org> napisał(a):

> has_version() can't handle any-of deps, and I see no point in
> introducing special magic to handle pypy-bin there. Instead, just check
> if the interpreter executable is installed. It is simpler and faster
> this way.
> ---
>  gx86/eclass/python-any-r1.eclass | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/gx86/eclass/python-any-r1.eclass b/gx86/eclass/python-any-r1.eclass
> index aa11cf7..b392453 100644
> --- a/gx86/eclass/python-any-r1.eclass
> +++ b/gx86/eclass/python-any-r1.eclass
> @@ -176,9 +176,10 @@ _python_EPYTHON_supported() {
>  	esac
>  
>  	if has "${i}" "${PYTHON_COMPAT[@]}"; then
> -		local PYTHON_PKG_DEP
> -		python_export "${i}" PYTHON_PKG_DEP
> -		if ROOT=/ has_version "${PYTHON_PKG_DEP}"; then
> +		local PYTHON
> +		python_export PYTHON
> +
> +		if [[ -x ${PYTHON} ]]; then
>  			if declare -f python_check_deps >/dev/null; then
>  				local PYTHON_USEDEP="python_targets_${i}(-),python_single_target_${i}(+)"
>  				python_check_deps

marienz noticed that the previous version enforced PYTHON_REQ_USE
and the new one doesn't. Let's discard this patch then and look for
a better solution.

-- 
Best regards,
Michał Górny

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

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

* Re: [gentoo-python] [PATCH] Eclass support for pypy-bin
  2013-07-22  9:49 [gentoo-python] [PATCH] Eclass support for pypy-bin Michał Górny
                   ` (5 preceding siblings ...)
  2013-07-22  9:51 ` [gentoo-python] [PATCH 6/6] [python.eclass] Support pypy-bin in python_get_implement Michał Górny
@ 2013-07-27 11:22 ` Michał Górny
  6 siblings, 0 replies; 10+ messages in thread
From: Michał Górny @ 2013-07-27 11:22 UTC (permalink / raw
  To: Michał Górny; +Cc: gentoo-python

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

Dnia 2013-07-22, o godz. 11:49:17
Michał Górny <mgorny@gentoo.org> napisał(a):

> python-any-r1.eclass:
> 
> 1) use PYTHON_PKG_DEP for generating deps
> 
> I must have missed it when converting the other two eclasses.

This one committed.

The remaining ones were withdrawn due to the issues pointed out by
marienz. Instead, I've committed virtual/pypy and dev-python/pypy-bin.

-- 
Best regards,
Michał Górny

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

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

end of thread, other threads:[~2013-07-27 11:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-22  9:49 [gentoo-python] [PATCH] Eclass support for pypy-bin Michał Górny
2013-07-22  9:50 ` [gentoo-python] [PATCH 1/6] [python-any-r1] use PYTHON_PKG_DEP for generating deps Michał Górny
2013-07-27  9:39   ` Michał Górny
2013-07-22  9:51 ` [gentoo-python] [PATCH 2/6] [python-any-r1] do not use has_version() for interpreter checks Michał Górny
2013-07-27  9:45   ` Michał Górny
2013-07-22  9:51 ` [gentoo-python] [PATCH 3/6] [python-utils-r1] Reorder PYTHON_PKG_DEP gen Michał Górny
2013-07-22  9:51 ` [gentoo-python] [PATCH 4/6] [python-utils-r1] Support pypy-bin in PYTHON_PKG_DEP Michał Górny
2013-07-22  9:51 ` [gentoo-python] [PATCH 5/6] [python-distutils-ng] Support pypy-bin Michał Górny
2013-07-22  9:51 ` [gentoo-python] [PATCH 6/6] [python.eclass] Support pypy-bin in python_get_implement Michał Górny
2013-07-27 11:22 ` [gentoo-python] [PATCH] Eclass support for pypy-bin Michał Górny

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