public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/6] Drop pointless default S assignment.
@ 2012-09-19 10:00 Michał Górny
  2012-09-19 10:00 ` [gentoo-dev] [PATCH 2/6] Move EXPORT_FUNCTIONS after the EAPI switch Michał Górny
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Michał Górny @ 2012-09-19 10:00 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

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

diff --git a/gx86/eclass/python-distutils-ng.eclass b/gx86/eclass/python-distutils-ng.eclass
index 4aecc3c..a2d5fa5 100644
--- a/gx86/eclass/python-distutils-ng.eclass
+++ b/gx86/eclass/python-distutils-ng.eclass
@@ -66,7 +66,6 @@ case "${EAPI}" in
 		die "Unsupported EAPI=${EAPI} (too old) for python-distutils-ng.eclass" ;;
 	4)
 		# EAPI=4 needed for REQUIRED_USE
-		S="${S:-${WORKDIR}/${P}}"
 		;;
 	*)
 		die "Unsupported EAPI=${EAPI} (unknown) for python-distutils-ng.eclass" ;;
-- 
1.7.12



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

* [gentoo-dev] [PATCH 2/6] Move EXPORT_FUNCTIONS after the EAPI switch.
  2012-09-19 10:00 [gentoo-dev] [PATCH 1/6] Drop pointless default S assignment Michał Górny
@ 2012-09-19 10:00 ` Michał Górny
  2012-09-19 10:00 ` [gentoo-dev] [PATCH 3/6] Temporarily remove PYTHON_OPTIONAL -- it is mis-designed Michał Górny
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2012-09-19 10:00 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

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

diff --git a/gx86/eclass/python-distutils-ng.eclass b/gx86/eclass/python-distutils-ng.eclass
index a2d5fa5..f4c957c 100644
--- a/gx86/eclass/python-distutils-ng.eclass
+++ b/gx86/eclass/python-distutils-ng.eclass
@@ -59,8 +59,6 @@ fi
 # Set to any value to disable automatic reinstallation of scripts in bin
 # directories. See python-distutils-ng_src_install function.
 
-EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
-
 case "${EAPI}" in
 	0|1|2|3)
 		die "Unsupported EAPI=${EAPI} (too old) for python-distutils-ng.eclass" ;;
@@ -71,6 +69,8 @@ case "${EAPI}" in
 		die "Unsupported EAPI=${EAPI} (unknown) for python-distutils-ng.eclass" ;;
 esac
 
+EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
+
 DEPEND="${DEPEND} !<sys-apps/portage-2.1.10.58"
 
 # @FUNCTION: _python-distutils-ng_get_binary_for_implementation
-- 
1.7.12



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

* [gentoo-dev] [PATCH 3/6] Temporarily remove PYTHON_OPTIONAL -- it is mis-designed.
  2012-09-19 10:00 [gentoo-dev] [PATCH 1/6] Drop pointless default S assignment Michał Górny
  2012-09-19 10:00 ` [gentoo-dev] [PATCH 2/6] Move EXPORT_FUNCTIONS after the EAPI switch Michał Górny
@ 2012-09-19 10:00 ` Michał Górny
  2012-09-19 10:00 ` [gentoo-dev] [PATCH 4/6] Support PYTHON_COMPAT being an array Michał Górny
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2012-09-19 10:00 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Let's remove it quickly before someone starts relying on it. Hopefully,
noone outside the tree started to do that -- assumption based
on the fact that it is very unlikely for a package to want optional
distutils.
---
 gx86/eclass/python-distutils-ng.eclass | 32 +++-----------------------------
 1 file changed, 3 insertions(+), 29 deletions(-)

diff --git a/gx86/eclass/python-distutils-ng.eclass b/gx86/eclass/python-distutils-ng.eclass
index f4c957c..8427994 100644
--- a/gx86/eclass/python-distutils-ng.eclass
+++ b/gx86/eclass/python-distutils-ng.eclass
@@ -41,12 +41,6 @@ if [[ -z "${PYTHON_COMPAT}" ]]; then
 	PYTHON_COMPAT+=" pypy1_8 pypy1_9"
 fi
 
-# @ECLASS-VARIABLE: PYTHON_OPTIONAL
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# Set the value to "yes" to make the dependency on a Python interpreter
-# optional.
-
 # @ECLASS-VARIABLE: PYTHON_DISABLE_COMPILATION
 # @DEFAULT_UNSET
 # @DESCRIPTION:
@@ -98,12 +92,7 @@ for impl in ${PYTHON_COMPAT}; do
 	required_use_str+=" python_targets_${impl}"
 done
 required_use_str=" || ( ${required_use_str} )"
-if [[ "${PYTHON_OPTIONAL}" = "yes" ]]; then
-	IUSE+=" python"
-	REQUIRED_USE+=" python? ( ${required_use_str} )"
-else
-	REQUIRED_USE+=" ${required_use_str}"
-fi
+REQUIRED_USE+=" ${required_use_str}"
 unset required_use_str
 
 for impl in ${PYTHON_COMPAT}; do
@@ -121,13 +110,8 @@ for impl in ${PYTHON_COMPAT}; do
 	esac
 	dep_str="python_targets_${impl}? ( ${dep_str} )"
 
-	if [[ "${PYTHON_OPTIONAL}" = "yes" ]]; then
-		RDEPEND="${RDEPEND} python? ( ${dep_str} )"
-		DEPEND="${DEPEND} python? ( ${dep_str} )"
-	else
-		RDEPEND="${RDEPEND} ${dep_str}"
-		DEPEND="${DEPEND} ${dep_str}"
-	fi
+	RDEPEND="${RDEPEND} ${dep_str}"
+	DEPEND="${DEPEND} ${dep_str}"
 	unset dep_str
 done
 
@@ -304,8 +288,6 @@ python-distutils-ng_newscript() {
 
 # Phase function: src_prepare
 python-distutils-ng_src_prepare() {
-	[[ "${PYTHON_OPTIONAL}" = "yes" ]] && { use python || return; }
-
 	# Try to run binary for each implementation:
 	for impl in ${PYTHON_COMPAT}; do
 		use "python_targets_${impl}" ${PYTHON_COMPAT} || continue
@@ -336,8 +318,6 @@ python-distutils-ng_src_prepare() {
 
 # Phase function: src_configure
 python-distutils-ng_src_configure() {
-	[[ "${PYTHON_OPTIONAL}" = "yes" ]] && { use python || return; }
-
 	if type python_configure &> /dev/null; then
 		_python-distutils-ng_run_for_each_impl python_configure
 	fi
@@ -345,8 +325,6 @@ python-distutils-ng_src_configure() {
 
 # Phase function: src_compile
 python-distutils-ng_src_compile() {
-	[[ "${PYTHON_OPTIONAL}" = "yes" ]] && { use python || return; }
-
 	if type python_compile &> /dev/null; then
 		_python-distutils-ng_run_for_each_impl python_compile
 	else
@@ -357,8 +335,6 @@ python-distutils-ng_src_compile() {
 
 # Phase function: src_test
 python-distutils-ng_src_test() {
-	[[ "${PYTHON_OPTIONAL}" = "yes" ]] && { use python || return; }
-
 	if type python_test &> /dev/null; then
 		_python-distutils-ng_run_for_each_impl python_test
 	fi
@@ -366,8 +342,6 @@ python-distutils-ng_src_test() {
 
 # Phase function: src_install
 python-distutils-ng_src_install() {
-	[[ "${PYTHON_OPTIONAL}" = "yes" ]] && { use python || return; }
-
 	if type python_install &> /dev/null; then
 		_python-distutils-ng_run_for_each_impl python_install
 	else
-- 
1.7.12



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

* [gentoo-dev] [PATCH 4/6] Support PYTHON_COMPAT being an array.
  2012-09-19 10:00 [gentoo-dev] [PATCH 1/6] Drop pointless default S assignment Michał Górny
  2012-09-19 10:00 ` [gentoo-dev] [PATCH 2/6] Move EXPORT_FUNCTIONS after the EAPI switch Michał Górny
  2012-09-19 10:00 ` [gentoo-dev] [PATCH 3/6] Temporarily remove PYTHON_OPTIONAL -- it is mis-designed Michał Górny
@ 2012-09-19 10:00 ` Michał Górny
  2012-09-19 10:00 ` [gentoo-dev] [PATCH 5/6] Move PYTHON_COMPAT, IUSE and REQUIRED_USE to python-r1 Michał Górny
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2012-09-19 10:00 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

---
 gx86/eclass/python-distutils-ng.eclass | 27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)

diff --git a/gx86/eclass/python-distutils-ng.eclass b/gx86/eclass/python-distutils-ng.eclass
index 8427994..edc38a4 100644
--- a/gx86/eclass/python-distutils-ng.eclass
+++ b/gx86/eclass/python-distutils-ng.eclass
@@ -32,6 +32,9 @@
 # This variable contains a space separated list of implementations (see above) a
 # package is compatible to. It must be set before the `inherit' call. The
 # default is to enable all implementations.
+#
+# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar, the eclass
+# will implicitly convert it to an array.
 
 if [[ -z "${PYTHON_COMPAT}" ]]; then
 	# Default: pure python, support all implementations
@@ -41,6 +44,8 @@ if [[ -z "${PYTHON_COMPAT}" ]]; then
 	PYTHON_COMPAT+=" pypy1_8 pypy1_9"
 fi
 
+PYTHON_COMPAT=( ${PYTHON_COMPAT[@]} )
+
 # @ECLASS-VARIABLE: PYTHON_DISABLE_COMPILATION
 # @DEFAULT_UNSET
 # @DESCRIPTION:
@@ -88,14 +93,14 @@ _python-distutils-ng_get_binary_for_implementation() {
 }
 
 required_use_str=""
-for impl in ${PYTHON_COMPAT}; do
+for impl in ${PYTHON_COMPAT[@]}; do
 	required_use_str+=" python_targets_${impl}"
 done
 required_use_str=" || ( ${required_use_str} )"
 REQUIRED_USE+=" ${required_use_str}"
 unset required_use_str
 
-for impl in ${PYTHON_COMPAT}; do
+for impl in ${PYTHON_COMPAT[@]}; do
 	IUSE+=" python_targets_${impl}"
 	dep_str="${impl/_/.}"
 	case "${dep_str}" in
@@ -147,8 +152,8 @@ _python-distutils-ng_run_for_impl() {
 _python-distutils-ng_run_for_each_impl() {
 	local command="${1}"
 
-	for impl in ${PYTHON_COMPAT}; do
-		use "python_targets_${impl}" ${PYTHON_COMPAT} || continue
+	for impl in ${PYTHON_COMPAT[@]}; do
+		use "python_targets_${impl}" ${PYTHON_COMPAT[@]} || continue
 		_python-distutils-ng_run_for_impl "${impl}" "${command}"
 	done
 }
@@ -247,7 +252,7 @@ python-distutils-ng_newscript() {
 	local destination_directory="/usr/bin"
 	[[ -n "${3}" ]] && destination_directory="${3}"
 
-	for impl in ${PYTHON_COMPAT}; do
+	for impl in ${PYTHON_COMPAT[@]}; do
 		use "python_targets_${impl}" || continue
 		enabled_impls=$((enabled_impls + 1))
 	done
@@ -274,8 +279,8 @@ python-distutils-ng_newscript() {
 		python-distutils-ng_rewrite_hashbang "${D}${destination_directory}/${destination_file}" "${default_impl}"
 	else
 		einfo "Installing ${source_file} for multiple implementations (default: ${default_impl}) in ${destination_directory}"
-		for impl in ${PYTHON_COMPAT}; do
-			use "python_targets_${impl}" ${PYTHON_COMPAT} || continue
+		for impl in ${PYTHON_COMPAT[@]}; do
+			use "python_targets_${impl}" ${PYTHON_COMPAT[@]} || continue
 
 			newins "${source_file}" "${destination_file}-${impl}"
 			fperms 755 "${destination_directory}/${destination_file}-${impl}"
@@ -289,8 +294,8 @@ python-distutils-ng_newscript() {
 # Phase function: src_prepare
 python-distutils-ng_src_prepare() {
 	# Try to run binary for each implementation:
-	for impl in ${PYTHON_COMPAT}; do
-		use "python_targets_${impl}" ${PYTHON_COMPAT} || continue
+	for impl in ${PYTHON_COMPAT[@]}; do
+		use "python_targets_${impl}" ${PYTHON_COMPAT[@]} || continue
 		$(_python-distutils-ng_get_binary_for_implementation "${impl}") \
 			-c "import sys" || die
 	done
@@ -302,8 +307,8 @@ python-distutils-ng_src_prepare() {
 	fi
 
 	# Create a copy of S for each implementation:
-	for impl in ${PYTHON_COMPAT}; do
-		use "python_targets_${impl}" ${PYTHON_COMPAT} || continue
+	for impl in ${PYTHON_COMPAT[@]}; do
+		use "python_targets_${impl}" ${PYTHON_COMPAT[@]} || continue
 
 		einfo "Creating copy for ${impl} in ${WORKDIR}/impl_${impl}"
 		mkdir -p "${WORKDIR}/impl_${impl}" || die
-- 
1.7.12



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

* [gentoo-dev] [PATCH 5/6] Move PYTHON_COMPAT, IUSE and REQUIRED_USE to python-r1.
  2012-09-19 10:00 [gentoo-dev] [PATCH 1/6] Drop pointless default S assignment Michał Górny
                   ` (2 preceding siblings ...)
  2012-09-19 10:00 ` [gentoo-dev] [PATCH 4/6] Support PYTHON_COMPAT being an array Michał Górny
@ 2012-09-19 10:00 ` Michał Górny
  2012-09-19 10:00 ` [gentoo-dev] [PATCH 6/6] Generate python depstrings in python-r1 Michał Górny
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2012-09-19 10:00 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

---
 gx86/eclass/python-distutils-ng.eclass | 31 ++------------------
 gx86/eclass/python-r1.eclass           | 53 ++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 29 deletions(-)
 create mode 100644 gx86/eclass/python-r1.eclass

diff --git a/gx86/eclass/python-distutils-ng.eclass b/gx86/eclass/python-distutils-ng.eclass
index edc38a4..5df965c 100644
--- a/gx86/eclass/python-distutils-ng.eclass
+++ b/gx86/eclass/python-distutils-ng.eclass
@@ -26,26 +26,6 @@
 #    each implementation and python_install_all that will be run in original
 #    directory (so it will not contain any implementation-specific files)
 
-# @ECLASS-VARIABLE: PYTHON_COMPAT
-# @DEFAULT_UNSET
-# @DESCRIPTION:
-# This variable contains a space separated list of implementations (see above) a
-# package is compatible to. It must be set before the `inherit' call. The
-# default is to enable all implementations.
-#
-# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar, the eclass
-# will implicitly convert it to an array.
-
-if [[ -z "${PYTHON_COMPAT}" ]]; then
-	# Default: pure python, support all implementations
-	PYTHON_COMPAT="  python2_5 python2_6 python2_7"
-	PYTHON_COMPAT+=" python3_1 python3_2"
-	PYTHON_COMPAT+=" jython2_5"
-	PYTHON_COMPAT+=" pypy1_8 pypy1_9"
-fi
-
-PYTHON_COMPAT=( ${PYTHON_COMPAT[@]} )
-
 # @ECLASS-VARIABLE: PYTHON_DISABLE_COMPILATION
 # @DEFAULT_UNSET
 # @DESCRIPTION:
@@ -68,6 +48,8 @@ case "${EAPI}" in
 		die "Unsupported EAPI=${EAPI} (unknown) for python-distutils-ng.eclass" ;;
 esac
 
+inherit python-r1
+
 EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
 
 DEPEND="${DEPEND} !<sys-apps/portage-2.1.10.58"
@@ -92,16 +74,7 @@ _python-distutils-ng_get_binary_for_implementation() {
 	esac
 }
 
-required_use_str=""
-for impl in ${PYTHON_COMPAT[@]}; do
-	required_use_str+=" python_targets_${impl}"
-done
-required_use_str=" || ( ${required_use_str} )"
-REQUIRED_USE+=" ${required_use_str}"
-unset required_use_str
-
 for impl in ${PYTHON_COMPAT[@]}; do
-	IUSE+=" python_targets_${impl}"
 	dep_str="${impl/_/.}"
 	case "${dep_str}" in
 		python?.?)
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
new file mode 100644
index 0000000..18f9246
--- /dev/null
+++ b/gx86/eclass/python-r1.eclass
@@ -0,0 +1,53 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+# @ECLASS: python-r1
+# @MAINTAINER:
+# Python herd <python@gentoo.org>
+# @AUTHOR:
+# Author: Michał Górny <mgorny@gentoo.org>
+# Based on work of: Krzysztof Pawlik <nelchael@gentoo.org>
+# @BLURB: A common eclass for Python packages supporting multiple ABIs.
+# @DESCRIPTION:
+
+case "${EAPI}" in
+	0|1|2|3)
+		die "Unsupported EAPI=${EAPI} (too old) for ${ECLASS}"
+		;;
+	4)
+		# EAPI=4 needed for REQUIRED_USE
+		;;
+	*)
+		die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
+		;;
+esac
+
+# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
+# @INTERNAL
+# @DESCRIPTION:
+# All supported Python implementations, most preferred first.
+_PYTHON_ALL_IMPLS=(
+	python2_7 python2_6 python2_5
+	python3_2 python3_1
+	pypy1_9 pypy1_8
+	jython2_5
+)
+
+# @ECLASS-VARIABLE: PYTHON_COMPAT
+# @DESCRIPTION:
+# This variable contains a space separated list of Pythonimplementations
+# a package supports. It must be set before the `inherit' call.
+# The default is to enable all implementations.
+#
+# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar, the eclass
+# will implicitly convert it to an array.
+: ${PYTHON_COMPAT:=${_PYTHON_ALL_IMPLS[@]}}
+
+PYTHON_COMPAT=( ${PYTHON_COMPAT[@]} )
+
+_python_set_globals() {
+	IUSE=${PYTHON_COMPAT[@]/#/python_targets_}
+	REQUIRED_USE="|| ( ${IUSE} )"
+}
+_python_set_globals
-- 
1.7.12



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

* [gentoo-dev] [PATCH 6/6] Generate python depstrings in python-r1.
  2012-09-19 10:00 [gentoo-dev] [PATCH 1/6] Drop pointless default S assignment Michał Górny
                   ` (3 preceding siblings ...)
  2012-09-19 10:00 ` [gentoo-dev] [PATCH 5/6] Move PYTHON_COMPAT, IUSE and REQUIRED_USE to python-r1 Michał Górny
@ 2012-09-19 10:00 ` Michał Górny
  2012-09-19 13:00   ` Ian Stakenvicius
  2012-09-19 21:43 ` [gentoo-dev] [PATCH 1/3] Generate python depstrings in python-r1 (updated) Michał Górny
  2012-09-24 21:11 ` [gentoo-dev] [PATCH] python-r1: introduce PYTHON executable getter Michał Górny
  6 siblings, 1 reply; 15+ messages in thread
From: Michał Górny @ 2012-09-19 10:00 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

---
 gx86/eclass/python-distutils-ng.eclass | 20 ++------------------
 gx86/eclass/python-r1.eclass           | 28 ++++++++++++++++++++++++++--
 2 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/gx86/eclass/python-distutils-ng.eclass b/gx86/eclass/python-distutils-ng.eclass
index 5df965c..bffe563 100644
--- a/gx86/eclass/python-distutils-ng.eclass
+++ b/gx86/eclass/python-distutils-ng.eclass
@@ -74,24 +74,8 @@ _python-distutils-ng_get_binary_for_implementation() {
 	esac
 }
 
-for impl in ${PYTHON_COMPAT[@]}; do
-	dep_str="${impl/_/.}"
-	case "${dep_str}" in
-		python?.?)
-			dep_str="dev-lang/python:${dep_str: -3}" ;;
-		jython?.?)
-			dep_str="dev-java/jython:${dep_str: -3}" ;;
-		pypy?.?)
-			dep_str="dev-python/pypy:${dep_str: -3}" ;;
-		*)
-			die "Unsupported implementation: ${impl}" ;;
-	esac
-	dep_str="python_targets_${impl}? ( ${dep_str} )"
-
-	RDEPEND="${RDEPEND} ${dep_str}"
-	DEPEND="${DEPEND} ${dep_str}"
-	unset dep_str
-done
+RDEPEND=${PYTHON_DEPEND}
+DEPEND=${PYTHON_DEPEND}
 
 _PACKAGE_SPECIFIC_S="${S#${WORKDIR}/}"
 
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index 18f9246..3017dd8 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -40,14 +40,38 @@ _PYTHON_ALL_IMPLS=(
 # a package supports. It must be set before the `inherit' call.
 # The default is to enable all implementations.
 #
-# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar, the eclass
-# will implicitly convert it to an array.
+# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar,
+# the eclass will implicitly convert it to an array.
 : ${PYTHON_COMPAT:=${_PYTHON_ALL_IMPLS[@]}}
 
+# @ECLASS-VARIABLE: PYTHON_DEPEND
+# @DESCRIPTION:
+# This is an eclass-generated Python dependency string for all
+# implementations listed in PYTHON_COMPAT.
+
 PYTHON_COMPAT=( ${PYTHON_COMPAT[@]} )
 
 _python_set_globals() {
 	IUSE=${PYTHON_COMPAT[@]/#/python_targets_}
 	REQUIRED_USE="|| ( ${IUSE} )"
+
+	PYTHON_DEPEND=
+	local i
+	for i in ${PYTHON_COMPAT[@]}; do
+		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
+
+		local v=${i##*[a-z]}
+		PYTHON_DEPEND+=" python_targets_${i}? ( ${d}:${v/_/.} )"
+	done
 }
 _python_set_globals
-- 
1.7.12



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

* Re: [gentoo-dev] [PATCH 6/6] Generate python depstrings in python-r1.
  2012-09-19 10:00 ` [gentoo-dev] [PATCH 6/6] Generate python depstrings in python-r1 Michał Górny
@ 2012-09-19 13:00   ` Ian Stakenvicius
  2012-09-19 17:37     ` Michał Górny
  0 siblings, 1 reply; 15+ messages in thread
From: Ian Stakenvicius @ 2012-09-19 13:00 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 19/09/12 06:00 AM, Micha? Górny wrote:
> --- gx86/eclass/python-distutils-ng.eclass | 20
> ++------------------ gx86/eclass/python-r1.eclass           | 28
> ++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 20
> deletions(-)
> 
> diff --git a/gx86/eclass/python-distutils-ng.eclass
> b/gx86/eclass/python-distutils-ng.eclass index 5df965c..bffe563
> 100644 --- a/gx86/eclass/python-distutils-ng.eclass +++
> b/gx86/eclass/python-distutils-ng.eclass @@ -74,24 +74,8 @@
> _python-distutils-ng_get_binary_for_implementation() { esac }
> 
> -for impl in ${PYTHON_COMPAT[@]}; do -	dep_str="${impl/_/.}" -	case
> "${dep_str}" in -		python?.?) -
> dep_str="dev-lang/python:${dep_str: -3}" ;; -		jython?.?) -
> dep_str="dev-java/jython:${dep_str: -3}" ;; -		pypy?.?) -
> dep_str="dev-python/pypy:${dep_str: -3}" ;; -		*) -			die
> "Unsupported implementation: ${impl}" ;; -	esac -
> dep_str="python_targets_${impl}? ( ${dep_str} )" - -
> RDEPEND="${RDEPEND} ${dep_str}" -	DEPEND="${DEPEND} ${dep_str}" -
> unset dep_str -done +RDEPEND=${PYTHON_DEPEND} 
> +DEPEND=${PYTHON_DEPEND}
> 
> _PACKAGE_SPECIFIC_S="${S#${WORKDIR}/}"
> 
> diff --git a/gx86/eclass/python-r1.eclass
> b/gx86/eclass/python-r1.eclass index 18f9246..3017dd8 100644 ---
> a/gx86/eclass/python-r1.eclass +++ b/gx86/eclass/python-r1.eclass 
> @@ -40,14 +40,38 @@ _PYTHON_ALL_IMPLS=( # a package supports. It
> must be set before the `inherit' call. # The default is to enable
> all implementations. # -# PYTHON_COMPAT can be either a scalar or
> an array. If it's a scalar, the eclass -# will implicitly convert
> it to an array. +# PYTHON_COMPAT can be either a scalar or an
> array. If it's a scalar, +# the eclass will implicitly convert it
> to an array. : ${PYTHON_COMPAT:=${_PYTHON_ALL_IMPLS[@]}}
> 
> +# @ECLASS-VARIABLE: PYTHON_DEPEND +# @DESCRIPTION: +# This is an
> eclass-generated Python dependency string for all +#
> implementations listed in PYTHON_COMPAT. + PYTHON_COMPAT=(
> ${PYTHON_COMPAT[@]} )
> 
> _python_set_globals() { IUSE=${PYTHON_COMPAT[@]/#/python_targets_} 
> REQUIRED_USE="|| ( ${IUSE} )" + +	PYTHON_DEPEND= +	local i +	for i
> in ${PYTHON_COMPAT[@]}; do +		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 + +		local v=${i##*[a-z]} +
> PYTHON_DEPEND+=" python_targets_${i}? ( ${d}:${v/_/.} )" +	done } 
> _python_set_globals


I think we really need to use a different variable than
"PYTHON_DEPEND".  There are ebuilds that inherit both python.eclass
and python-distutils-ng.eclass and so this will obviously break those
cases..  (that said, I do think that python-r1.eclass should gain
whatever bits it is missing so said inherit on python.eclass isn't
necessary, but that's beside the point)


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iF4EAREIAAYFAlBZwgEACgkQ2ugaI38ACPAYCQD/UP8eEcsQygtNdNaXR6fXF1Ef
p4IYbkg/S16F372FM7MBAJkib9wdbK+3Txbvwxik5xxgtfTNmKh9iQl5DHmXRiSC
=Djl7
-----END PGP SIGNATURE-----


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

* Re: [gentoo-dev] [PATCH 6/6] Generate python depstrings in python-r1.
  2012-09-19 13:00   ` Ian Stakenvicius
@ 2012-09-19 17:37     ` Michał Górny
  2012-09-19 17:58       ` Ian Stakenvicius
  0 siblings, 1 reply; 15+ messages in thread
From: Michał Górny @ 2012-09-19 17:37 UTC (permalink / raw
  To: gentoo-dev; +Cc: axs

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

On Wed, 19 Sep 2012 09:00:49 -0400
Ian Stakenvicius <axs@gentoo.org> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> On 19/09/12 06:00 AM, Micha? Górny wrote:
> > --- gx86/eclass/python-distutils-ng.eclass | 20
> > ++------------------ gx86/eclass/python-r1.eclass           | 28
> > ++++++++++++++++++++++++++-- 2 files changed, 28 insertions(+), 20
> > deletions(-)
> > 
> > diff --git a/gx86/eclass/python-distutils-ng.eclass
> > b/gx86/eclass/python-distutils-ng.eclass index 5df965c..bffe563
> > 100644 --- a/gx86/eclass/python-distutils-ng.eclass +++
> > b/gx86/eclass/python-distutils-ng.eclass @@ -74,24 +74,8 @@
> > _python-distutils-ng_get_binary_for_implementation() { esac }
> > 
> > -for impl in ${PYTHON_COMPAT[@]}; do -	dep_str="${impl/_/.}"
> > -	case "${dep_str}" in -		python?.?) -
> > dep_str="dev-lang/python:${dep_str: -3}" ;; -
> > jython?.?) - dep_str="dev-java/jython:${dep_str: -3}" ;;
> > -		pypy?.?) - dep_str="dev-python/pypy:${dep_str:
> > -3}" ;; -		*) -			die
> > "Unsupported implementation: ${impl}" ;; -	esac -
> > dep_str="python_targets_${impl}? ( ${dep_str} )" - -
> > RDEPEND="${RDEPEND} ${dep_str}" -	DEPEND="${DEPEND}
> > ${dep_str}" - unset dep_str -done +RDEPEND=${PYTHON_DEPEND}
> > +DEPEND=${PYTHON_DEPEND}
> > 
> > _PACKAGE_SPECIFIC_S="${S#${WORKDIR}/}"
> > 
> > diff --git a/gx86/eclass/python-r1.eclass
> > b/gx86/eclass/python-r1.eclass index 18f9246..3017dd8 100644 ---
> > a/gx86/eclass/python-r1.eclass +++ b/gx86/eclass/python-r1.eclass 
> > @@ -40,14 +40,38 @@ _PYTHON_ALL_IMPLS=( # a package supports. It
> > must be set before the `inherit' call. # The default is to enable
> > all implementations. # -# PYTHON_COMPAT can be either a scalar or
> > an array. If it's a scalar, the eclass -# will implicitly convert
> > it to an array. +# PYTHON_COMPAT can be either a scalar or an
> > array. If it's a scalar, +# the eclass will implicitly convert it
> > to an array. : ${PYTHON_COMPAT:=${_PYTHON_ALL_IMPLS[@]}}
> > 
> > +# @ECLASS-VARIABLE: PYTHON_DEPEND +# @DESCRIPTION: +# This is an
> > eclass-generated Python dependency string for all +#
> > implementations listed in PYTHON_COMPAT. + PYTHON_COMPAT=(
> > ${PYTHON_COMPAT[@]} )
> > 
> > _python_set_globals() { IUSE=${PYTHON_COMPAT[@]/#/python_targets_} 
> > REQUIRED_USE="|| ( ${IUSE} )" + +	PYTHON_DEPEND= +
> > local i +	for i in ${PYTHON_COMPAT[@]}; do +
> > 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 + +		local v=${i##*[a-z]} +
> > PYTHON_DEPEND+=" python_targets_${i}? ( ${d}:${v/_/.} )" +
> > done } _python_set_globals
> 
> 
> I think we really need to use a different variable than
> "PYTHON_DEPEND".  There are ebuilds that inherit both python.eclass
> and python-distutils-ng.eclass and so this will obviously break those
> cases..  (that said, I do think that python-r1.eclass should gain
> whatever bits it is missing so said inherit on python.eclass isn't
> necessary, but that's beside the point)

I'm not sure if we shouldn't forbid inheriting both eclasses. That's
a bit risky, at least. And it's very likely that someone is doing
something very wrong and not noticing the failure yet.

-- 
Best regards,
Michał Górny

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

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

* Re: [gentoo-dev] [PATCH 6/6] Generate python depstrings in python-r1.
  2012-09-19 17:37     ` Michał Górny
@ 2012-09-19 17:58       ` Ian Stakenvicius
  2012-09-19 18:40         ` Michał Górny
  0 siblings, 1 reply; 15+ messages in thread
From: Ian Stakenvicius @ 2012-09-19 17:58 UTC (permalink / raw
  To: gentoo-dev

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 19/09/12 01:37 PM, Michał Górny wrote:
> On Wed, 19 Sep 2012 09:00:49 -0400 Ian Stakenvicius
> <axs@gentoo.org> wrote:
> 
>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
>> 
>> On 19/09/12 06:00 AM, Micha? Górny wrote:
>>> --- gx86/eclass/python-distutils-ng.eclass | 20 
>>> ++------------------ gx86/eclass/python-r1.eclass           |
>>> 28 ++++++++++++++++++++++++++-- 2 files changed, 28
>>> insertions(+), 20 deletions(-)
>>> 
>>> diff --git a/gx86/eclass/python-distutils-ng.eclass 
>>> b/gx86/eclass/python-distutils-ng.eclass index
>>> 5df965c..bffe563 100644 ---
>>> a/gx86/eclass/python-distutils-ng.eclass +++ 
>>> b/gx86/eclass/python-distutils-ng.eclass @@ -74,24 +74,8 @@ 
>>> _python-distutils-ng_get_binary_for_implementation() { esac }
>>> 
>>> -for impl in ${PYTHON_COMPAT[@]}; do -	dep_str="${impl/_/.}" -
>>> case "${dep_str}" in -		python?.?) - 
>>> dep_str="dev-lang/python:${dep_str: -3}" ;; - jython?.?) -
>>> dep_str="dev-java/jython:${dep_str: -3}" ;; -		pypy?.?) -
>>> dep_str="dev-python/pypy:${dep_str: -3}" ;; -		*) -			die 
>>> "Unsupported implementation: ${impl}" ;; -	esac - 
>>> dep_str="python_targets_${impl}? ( ${dep_str} )" - - 
>>> RDEPEND="${RDEPEND} ${dep_str}" -	DEPEND="${DEPEND} ${dep_str}"
>>> - unset dep_str -done +RDEPEND=${PYTHON_DEPEND} 
>>> +DEPEND=${PYTHON_DEPEND}
>>> 
>>> _PACKAGE_SPECIFIC_S="${S#${WORKDIR}/}"
>>> 
>>> diff --git a/gx86/eclass/python-r1.eclass 
>>> b/gx86/eclass/python-r1.eclass index 18f9246..3017dd8 100644
>>> --- a/gx86/eclass/python-r1.eclass +++
>>> b/gx86/eclass/python-r1.eclass @@ -40,14 +40,38 @@
>>> _PYTHON_ALL_IMPLS=( # a package supports. It must be set before
>>> the `inherit' call. # The default is to enable all
>>> implementations. # -# PYTHON_COMPAT can be either a scalar or 
>>> an array. If it's a scalar, the eclass -# will implicitly
>>> convert it to an array. +# PYTHON_COMPAT can be either a scalar
>>> or an array. If it's a scalar, +# the eclass will implicitly
>>> convert it to an array. :
>>> ${PYTHON_COMPAT:=${_PYTHON_ALL_IMPLS[@]}}
>>> 
>>> +# @ECLASS-VARIABLE: PYTHON_DEPEND +# @DESCRIPTION: +# This is
>>> an eclass-generated Python dependency string for all +# 
>>> implementations listed in PYTHON_COMPAT. + PYTHON_COMPAT=( 
>>> ${PYTHON_COMPAT[@]} )
>>> 
>>> _python_set_globals() {
>>> IUSE=${PYTHON_COMPAT[@]/#/python_targets_} REQUIRED_USE="|| (
>>> ${IUSE} )" + +	PYTHON_DEPEND= + local i +	for i in
>>> ${PYTHON_COMPAT[@]}; do + 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 + +		local v=${i##*[a-z]} + 
>>> PYTHON_DEPEND+=" python_targets_${i}? ( ${d}:${v/_/.} )" + done
>>> } _python_set_globals
>> 
>> 
>> I think we really need to use a different variable than 
>> "PYTHON_DEPEND".  There are ebuilds that inherit both
>> python.eclass and python-distutils-ng.eclass and so this will
>> obviously break those cases..  (that said, I do think that
>> python-r1.eclass should gain whatever bits it is missing so said
>> inherit on python.eclass isn't necessary, but that's beside the
>> point)
> 
> I'm not sure if we shouldn't forbid inheriting both eclasses.
> That's a bit risky, at least. And it's very likely that someone is
> doing something very wrong and not noticing the failure yet.
> 

We can forbid a double-inherit, but that doesn't mean we should allow
PYTHON_DEPEND to be overloaded with two different meanings.

I would recommend instead to use 'PYTHON_DEPS'; it's different, and is
a more generic name which would seem to fit better when appended to
either/both DEPEND and RDEPEND.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (GNU/Linux)

iF4EAREIAAYFAlBaB74ACgkQ2ugaI38ACPD4mwD/e++PURTyeBoeFZodadFVDBYh
tBIuTaDFeuR7+PKNgPwA/1WFz8urK1ErpDLWTVsLqIUZra0L0RFG5/d+8jr3DPVQ
=bZPZ
-----END PGP SIGNATURE-----


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

* Re: [gentoo-dev] [PATCH 6/6] Generate python depstrings in python-r1.
  2012-09-19 17:58       ` Ian Stakenvicius
@ 2012-09-19 18:40         ` Michał Górny
  0 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2012-09-19 18:40 UTC (permalink / raw
  To: gentoo-dev; +Cc: axs

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

On Wed, 19 Sep 2012 13:58:22 -0400
Ian Stakenvicius <axs@gentoo.org> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA256
> 
> On 19/09/12 01:37 PM, Michał Górny wrote:
> > On Wed, 19 Sep 2012 09:00:49 -0400 Ian Stakenvicius
> > <axs@gentoo.org> wrote:
> > 
> >> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256
> >> 
> >> On 19/09/12 06:00 AM, Micha? Górny wrote:
> >>> --- gx86/eclass/python-distutils-ng.eclass | 20 
> >>> ++------------------ gx86/eclass/python-r1.eclass           |
> >>> 28 ++++++++++++++++++++++++++-- 2 files changed, 28
> >>> insertions(+), 20 deletions(-)
> >>> 
> >>> diff --git a/gx86/eclass/python-distutils-ng.eclass 
> >>> b/gx86/eclass/python-distutils-ng.eclass index
> >>> 5df965c..bffe563 100644 ---
> >>> a/gx86/eclass/python-distutils-ng.eclass +++ 
> >>> b/gx86/eclass/python-distutils-ng.eclass @@ -74,24 +74,8 @@ 
> >>> _python-distutils-ng_get_binary_for_implementation() { esac }
> >>> 
> >>> -for impl in ${PYTHON_COMPAT[@]}; do -
> >>> dep_str="${impl/_/.}" - case "${dep_str}" in -
> >>> python?.?) - dep_str="dev-lang/python:${dep_str: -3}" ;; -
> >>> jython?.?) - dep_str="dev-java/jython:${dep_str: -3}" ;;
> >>> -		pypy?.?) - dep_str="dev-python/pypy:${dep_str:
> >>> -3}" ;; -		*) -			die
> >>> "Unsupported implementation: ${impl}" ;; -	esac -
> >>> dep_str="python_targets_${impl}? ( ${dep_str} )" - -
> >>> RDEPEND="${RDEPEND} ${dep_str}" -	DEPEND="${DEPEND}
> >>> ${dep_str}"
> >>> - unset dep_str -done +RDEPEND=${PYTHON_DEPEND} 
> >>> +DEPEND=${PYTHON_DEPEND}
> >>> 
> >>> _PACKAGE_SPECIFIC_S="${S#${WORKDIR}/}"
> >>> 
> >>> diff --git a/gx86/eclass/python-r1.eclass 
> >>> b/gx86/eclass/python-r1.eclass index 18f9246..3017dd8 100644
> >>> --- a/gx86/eclass/python-r1.eclass +++
> >>> b/gx86/eclass/python-r1.eclass @@ -40,14 +40,38 @@
> >>> _PYTHON_ALL_IMPLS=( # a package supports. It must be set before
> >>> the `inherit' call. # The default is to enable all
> >>> implementations. # -# PYTHON_COMPAT can be either a scalar or 
> >>> an array. If it's a scalar, the eclass -# will implicitly
> >>> convert it to an array. +# PYTHON_COMPAT can be either a scalar
> >>> or an array. If it's a scalar, +# the eclass will implicitly
> >>> convert it to an array. :
> >>> ${PYTHON_COMPAT:=${_PYTHON_ALL_IMPLS[@]}}
> >>> 
> >>> +# @ECLASS-VARIABLE: PYTHON_DEPEND +# @DESCRIPTION: +# This is
> >>> an eclass-generated Python dependency string for all +# 
> >>> implementations listed in PYTHON_COMPAT. + PYTHON_COMPAT=( 
> >>> ${PYTHON_COMPAT[@]} )
> >>> 
> >>> _python_set_globals() {
> >>> IUSE=${PYTHON_COMPAT[@]/#/python_targets_} REQUIRED_USE="|| (
> >>> ${IUSE} )" + +	PYTHON_DEPEND= + local i +	for i in
> >>> ${PYTHON_COMPAT[@]}; do + 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 +
> >>> +		local v=${i##*[a-z]} + PYTHON_DEPEND+="
> >>> python_targets_${i}? ( ${d}:${v/_/.} )" + done }
> >>> _python_set_globals
> >> 
> >> 
> >> I think we really need to use a different variable than 
> >> "PYTHON_DEPEND".  There are ebuilds that inherit both
> >> python.eclass and python-distutils-ng.eclass and so this will
> >> obviously break those cases..  (that said, I do think that
> >> python-r1.eclass should gain whatever bits it is missing so said
> >> inherit on python.eclass isn't necessary, but that's beside the
> >> point)
> > 
> > I'm not sure if we shouldn't forbid inheriting both eclasses.
> > That's a bit risky, at least. And it's very likely that someone is
> > doing something very wrong and not noticing the failure yet.
> > 
> 
> We can forbid a double-inherit, but that doesn't mean we should allow
> PYTHON_DEPEND to be overloaded with two different meanings.
> 
> I would recommend instead to use 'PYTHON_DEPS'; it's different, and is
> a more generic name which would seem to fit better when appended to
> either/both DEPEND and RDEPEND.

PYDEPEND :>.

-- 
Best regards,
Michał Górny

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

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

* [gentoo-dev] [PATCH 1/3] Generate python depstrings in python-r1 (updated).
  2012-09-19 10:00 [gentoo-dev] [PATCH 1/6] Drop pointless default S assignment Michał Górny
                   ` (4 preceding siblings ...)
  2012-09-19 10:00 ` [gentoo-dev] [PATCH 6/6] Generate python depstrings in python-r1 Michał Górny
@ 2012-09-19 21:43 ` Michał Górny
  2012-09-19 21:43   ` [gentoo-dev] [PATCH 2/3] Generate PYTHON_USEDEP for use in cross-package deps Michał Górny
                     ` (2 more replies)
  2012-09-24 21:11 ` [gentoo-dev] [PATCH] python-r1: introduce PYTHON executable getter Michał Górny
  6 siblings, 3 replies; 15+ messages in thread
From: Michał Górny @ 2012-09-19 21:43 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

I've renamed PYTHON_DEPEND to avoid confusion with python.eclass.
---
 gx86/eclass/python-distutils-ng.eclass | 20 ++-----------------
 gx86/eclass/python-r1.eclass           | 35 ++++++++++++++++++++++++++++++++--
 2 files changed, 35 insertions(+), 20 deletions(-)

diff --git a/gx86/eclass/python-distutils-ng.eclass b/gx86/eclass/python-distutils-ng.eclass
index 5df965c..34717aa 100644
--- a/gx86/eclass/python-distutils-ng.eclass
+++ b/gx86/eclass/python-distutils-ng.eclass
@@ -74,24 +74,8 @@ _python-distutils-ng_get_binary_for_implementation() {
 	esac
 }
 
-for impl in ${PYTHON_COMPAT[@]}; do
-	dep_str="${impl/_/.}"
-	case "${dep_str}" in
-		python?.?)
-			dep_str="dev-lang/python:${dep_str: -3}" ;;
-		jython?.?)
-			dep_str="dev-java/jython:${dep_str: -3}" ;;
-		pypy?.?)
-			dep_str="dev-python/pypy:${dep_str: -3}" ;;
-		*)
-			die "Unsupported implementation: ${impl}" ;;
-	esac
-	dep_str="python_targets_${impl}? ( ${dep_str} )"
-
-	RDEPEND="${RDEPEND} ${dep_str}"
-	DEPEND="${DEPEND} ${dep_str}"
-	unset dep_str
-done
+RDEPEND=${PYTHON_DEPS}
+DEPEND=${PYTHON_DEPS}
 
 _PACKAGE_SPECIFIC_S="${S#${WORKDIR}/}"
 
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index 18f9246..957db68 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -40,14 +40,45 @@ _PYTHON_ALL_IMPLS=(
 # a package supports. It must be set before the `inherit' call.
 # The default is to enable all implementations.
 #
-# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar, the eclass
-# will implicitly convert it to an array.
+# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar,
+# the eclass will implicitly convert it to an array.
 : ${PYTHON_COMPAT:=${_PYTHON_ALL_IMPLS[@]}}
 
+# @ECLASS-VARIABLE: PYTHON_DEPS
+# @DESCRIPTION:
+# This is an eclass-generated Python dependency string for all
+# implementations listed in PYTHON_COMPAT. It should be used
+# in RDEPEND and/or DEPEND like:
+#
+# @CODE
+# RDEPEND="${PYTHON_DEPS}
+#   dev-foo/mydep"
+# DEPEND="${RDEPEND}"
+# @CODE
+
 PYTHON_COMPAT=( ${PYTHON_COMPAT[@]} )
 
 _python_set_globals() {
 	IUSE=${PYTHON_COMPAT[@]/#/python_targets_}
 	REQUIRED_USE="|| ( ${IUSE} )"
+
+	PYTHON_DEPS=
+	local i
+	for i in ${PYTHON_COMPAT[@]}; do
+		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
+
+		local v=${i##*[a-z]}
+		PYTHON_DEPS+=" python_targets_${i}? ( ${d}:${v/_/.} )"
+	done
 }
 _python_set_globals
-- 
1.7.12



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

* [gentoo-dev] [PATCH 2/3] Generate PYTHON_USEDEP for use in cross-package deps.
  2012-09-19 21:43 ` [gentoo-dev] [PATCH 1/3] Generate python depstrings in python-r1 (updated) Michał Górny
@ 2012-09-19 21:43   ` Michał Górny
  2012-09-19 21:43   ` [gentoo-dev] [PATCH 3/3] Support specifying the USE-deps for Python impl Michał Górny
  2012-09-22  4:47   ` [gentoo-dev] [PATCH 1/3] Generate python depstrings in python-r1 (updated) Ben de Groot
  2 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2012-09-19 21:43 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

This is based on a suggestion from Ian Stakenvicius.
---
 gx86/eclass/python-r1.eclass | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index 957db68..487b5e0 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -56,11 +56,25 @@ _PYTHON_ALL_IMPLS=(
 # DEPEND="${RDEPEND}"
 # @CODE
 
+# @ECLASS-VARIABLE: PYTHON_USEDEP
+# @DESCRIPTION:
+# This is an eclass-generated USE-dependency string which can be used to
+# depend on another Python package being built for the same Python
+# implementations. It should be used like:
+#
+# @CODE
+# RDEPEND="dev-python/foo[${PYTHON_USEDEP}]"
+# @CODE
+
 PYTHON_COMPAT=( ${PYTHON_COMPAT[@]} )
 
 _python_set_globals() {
-	IUSE=${PYTHON_COMPAT[@]/#/python_targets_}
-	REQUIRED_USE="|| ( ${IUSE} )"
+	local flags=( "${PYTHON_COMPAT[@]/#/python_targets_}" )
+	local optflags=${flags[@]/%/?}
+
+	IUSE=${flags}
+	REQUIRED_USE="|| ( ${flags} )"
+	PYTHON_USEDEP=${optflags// /,}
 
 	PYTHON_DEPS=
 	local i
-- 
1.7.12



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

* [gentoo-dev] [PATCH 3/3] Support specifying the USE-deps for Python impl.
  2012-09-19 21:43 ` [gentoo-dev] [PATCH 1/3] Generate python depstrings in python-r1 (updated) Michał Górny
  2012-09-19 21:43   ` [gentoo-dev] [PATCH 2/3] Generate PYTHON_USEDEP for use in cross-package deps Michał Górny
@ 2012-09-19 21:43   ` Michał Górny
  2012-09-22  4:47   ` [gentoo-dev] [PATCH 1/3] Generate python depstrings in python-r1 (updated) Ben de Groot
  2 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2012-09-19 21:43 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

As requested by hasufell.
---
 gx86/eclass/python-r1.eclass | 30 ++++++++++++++++++++++++++----
 1 file changed, 26 insertions(+), 4 deletions(-)

diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index 487b5e0..9659310 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -36,14 +36,33 @@ _PYTHON_ALL_IMPLS=(
 
 # @ECLASS-VARIABLE: PYTHON_COMPAT
 # @DESCRIPTION:
-# This variable contains a space separated list of Pythonimplementations
-# a package supports. It must be set before the `inherit' call.
-# The default is to enable all implementations.
+# This variable contains a space separated list of Python
+# implementations a package supports. It must be set before
+# the `inherit' call.  The default is to enable all implementations.
 #
 # PYTHON_COMPAT can be either a scalar or an array. If it's a scalar,
 # the eclass will implicitly convert it to an array.
 : ${PYTHON_COMPAT:=${_PYTHON_ALL_IMPLS[@]}}
 
+# @ECLASS-VARIABLE: PYTHON_COMPAT_USE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The list of USEflags required to be enabled on the chosen Python
+# implementations, formed as a USE-dependency string. It should be valid
+# for all implementations in PYTHON_COMPAT, so it may be necessary to
+# use USE defaults.
+#
+# Example:
+# @CODE
+# PYTHON_COMPAT_USE="gdbm,ncurses(-)?"
+# @CODE
+#
+# Will cause the Python dependencies to look like:
+# @CODE
+# python_targets_pythonX_Y? (
+#   dev-lang/python:X_Y[gdbm,ncurses(-)?] )
+# @CODE
+
 # @ECLASS-VARIABLE: PYTHON_DEPS
 # @DESCRIPTION:
 # This is an eclass-generated Python dependency string for all
@@ -92,7 +111,10 @@ _python_set_globals() {
 		esac
 
 		local v=${i##*[a-z]}
-		PYTHON_DEPS+=" python_targets_${i}? ( ${d}:${v/_/.} )"
+		local usestr
+		[[ ${PYTHON_COMPAT_USE} ]] && usestr="[${PYTHON_COMPAT_USE}]"
+		PYTHON_DEPS+=" python_targets_${i}? (
+			${d}:${v/_/.}${usestr} )"
 	done
 }
 _python_set_globals
-- 
1.7.12



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

* Re: [gentoo-dev] [PATCH 1/3] Generate python depstrings in python-r1 (updated).
  2012-09-19 21:43 ` [gentoo-dev] [PATCH 1/3] Generate python depstrings in python-r1 (updated) Michał Górny
  2012-09-19 21:43   ` [gentoo-dev] [PATCH 2/3] Generate PYTHON_USEDEP for use in cross-package deps Michał Górny
  2012-09-19 21:43   ` [gentoo-dev] [PATCH 3/3] Support specifying the USE-deps for Python impl Michał Górny
@ 2012-09-22  4:47   ` Ben de Groot
  2 siblings, 0 replies; 15+ messages in thread
From: Ben de Groot @ 2012-09-22  4:47 UTC (permalink / raw
  To: gentoo-dev

On 20 September 2012 05:43, Michał Górny <mgorny@gentoo.org> wrote:
> I've renamed PYTHON_DEPEND to avoid confusion with python.eclass.
> ---
>  gx86/eclass/python-distutils-ng.eclass | 20 ++-----------------
>  gx86/eclass/python-r1.eclass           | 35 ++++++++++++++++++++++++++++++++--
>  2 files changed, 35 insertions(+), 20 deletions(-)
>
> diff --git a/gx86/eclass/python-distutils-ng.eclass b/gx86/eclass/python-distutils-ng.eclass
> index 5df965c..34717aa 100644
> --- a/gx86/eclass/python-distutils-ng.eclass
> +++ b/gx86/eclass/python-distutils-ng.eclass
> @@ -74,24 +74,8 @@ _python-distutils-ng_get_binary_for_implementation() {
>         esac
>  }
>
> -for impl in ${PYTHON_COMPAT[@]}; do
> -       dep_str="${impl/_/.}"
> -       case "${dep_str}" in
> -               python?.?)
> -                       dep_str="dev-lang/python:${dep_str: -3}" ;;
> -               jython?.?)
> -                       dep_str="dev-java/jython:${dep_str: -3}" ;;
> -               pypy?.?)
> -                       dep_str="dev-python/pypy:${dep_str: -3}" ;;
> -               *)
> -                       die "Unsupported implementation: ${impl}" ;;
> -       esac
> -       dep_str="python_targets_${impl}? ( ${dep_str} )"
> -
> -       RDEPEND="${RDEPEND} ${dep_str}"
> -       DEPEND="${DEPEND} ${dep_str}"
> -       unset dep_str
> -done
> +RDEPEND=${PYTHON_DEPS}
> +DEPEND=${PYTHON_DEPS}
>
>  _PACKAGE_SPECIFIC_S="${S#${WORKDIR}/}"
>
> diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
> index 18f9246..957db68 100644
> --- a/gx86/eclass/python-r1.eclass
> +++ b/gx86/eclass/python-r1.eclass
> @@ -40,14 +40,45 @@ _PYTHON_ALL_IMPLS=(
>  # a package supports. It must be set before the `inherit' call.
>  # The default is to enable all implementations.
>  #
> -# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar, the eclass
> -# will implicitly convert it to an array.
> +# PYTHON_COMPAT can be either a scalar or an array. If it's a scalar,
> +# the eclass will implicitly convert it to an array.
>  : ${PYTHON_COMPAT:=${_PYTHON_ALL_IMPLS[@]}}
>
> +# @ECLASS-VARIABLE: PYTHON_DEPS
> +# @DESCRIPTION:
> +# This is an eclass-generated Python dependency string for all
> +# implementations listed in PYTHON_COMPAT. It should be used
> +# in RDEPEND and/or DEPEND like:
> +#
> +# @CODE
> +# RDEPEND="${PYTHON_DEPS}
> +#   dev-foo/mydep"
> +# DEPEND="${RDEPEND}"
> +# @CODE
> +
>  PYTHON_COMPAT=( ${PYTHON_COMPAT[@]} )
>
>  _python_set_globals() {
>         IUSE=${PYTHON_COMPAT[@]/#/python_targets_}
>         REQUIRED_USE="|| ( ${IUSE} )"
> +
> +       PYTHON_DEPS=
> +       local i
> +       for i in ${PYTHON_COMPAT[@]}; do
> +               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
> +
> +               local v=${i##*[a-z]}
> +               PYTHON_DEPS+=" python_targets_${i}? ( ${d}:${v/_/.} )"
> +       done
>  }
>  _python_set_globals
> --
> 1.7.12
>
>

This patchset looks good to me.

-- 
Cheers,

Ben | yngwin
Gentoo developer
Gentoo Qt project lead, Gentoo Wiki admin


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

* [gentoo-dev] [PATCH] python-r1: introduce PYTHON executable getter.
  2012-09-19 10:00 [gentoo-dev] [PATCH 1/6] Drop pointless default S assignment Michał Górny
                   ` (5 preceding siblings ...)
  2012-09-19 21:43 ` [gentoo-dev] [PATCH 1/3] Generate python depstrings in python-r1 (updated) Michał Górny
@ 2012-09-24 21:11 ` Michał Górny
  6 siblings, 0 replies; 15+ messages in thread
From: Michał Górny @ 2012-09-24 21:11 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

A semi-replacement for _python-distutils-ng_very_long_name...

Unlike the forementioned function, it returns just the binary name
and not the complete path. Thus, the executable rewrite in p-d-ng has
been changed to use #!/usr/bin/env.
---
 gx86/eclass/python-distutils-ng.eclass | 28 ++++------------------------
 gx86/eclass/python-r1.eclass           | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/gx86/eclass/python-distutils-ng.eclass b/gx86/eclass/python-distutils-ng.eclass
index 34717aa..33d183c 100644
--- a/gx86/eclass/python-distutils-ng.eclass
+++ b/gx86/eclass/python-distutils-ng.eclass
@@ -54,26 +54,6 @@ EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
 
 DEPEND="${DEPEND} !<sys-apps/portage-2.1.10.58"
 
-# @FUNCTION: _python-distutils-ng_get_binary_for_implementation
-# @USAGE: implementation
-# @RETURN: Full path to Python binary for given implementation.
-# @DESCRIPTION:
-# This function returns full path for Python binary for given implementation.
-#
-# Binary returned by this function should be used instead of simply calling
-# `python'.
-_python-distutils-ng_get_binary_for_implementation() {
-	local impl="${1/_/.}"
-	case "${impl}" in
-		python?.?|jython?.?)
-			echo "/usr/bin/${impl}" ;;
-		pypy?.?)
-			echo "/usr/bin/pypy-c${impl: -3}" ;;
-		*)
-			die "Unsupported implementation: ${1}" ;;
-	esac
-}
-
 RDEPEND=${PYTHON_DEPS}
 DEPEND=${PYTHON_DEPS}
 
@@ -90,7 +70,7 @@ _python-distutils-ng_run_for_impl() {
 	local command="${2}"
 
 	local S="${WORKDIR}/impl_${impl}/${_PACKAGE_SPECIFIC_S}"
-	PYTHON="$(_python-distutils-ng_get_binary_for_implementation "${impl}")"
+	PYTHON="$(python_get_PYTHON "${impl}")"
 	EPYTHON="${impl/_/.}"
 
 	einfo "Running ${command} in ${S} for ${impl}"
@@ -147,10 +127,10 @@ python-distutils-ng_rewrite_hashbang() {
 	[[ -n "${1}" ]] || die "Missing file name"
 	[[ -n "${2}" ]] || die "Missing implementation"
 	local file_name="${1}"
-	local binary="$(_python-distutils-ng_get_binary_for_implementation "${2}")"
+	local binary="$(python_get_PYTHON "${2}")"
 	[[ $(head -n 1 "${file_name}") == '#!'*(python|jython|pypy-c)* ]] || \
 		die "Missing or invalid #! line in ${file_name}"
-	sed -i -e "1c#!${binary}" "${file_name}" || die
+	sed -i -e "1c#!/usr/bin/env ${binary}" "${file_name}" || die
 }
 
 # @FUNCTION: python-distutils-ng_redoscript
@@ -253,7 +233,7 @@ python-distutils-ng_src_prepare() {
 	# Try to run binary for each implementation:
 	for impl in ${PYTHON_COMPAT[@]}; do
 		use "python_targets_${impl}" ${PYTHON_COMPAT[@]} || continue
-		$(_python-distutils-ng_get_binary_for_implementation "${impl}") \
+		$(python_get_PYTHON "${impl}") \
 			-c "import sys" || die
 	done
 
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index 68b5c38..4c4d69d 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -118,3 +118,23 @@ _python_set_globals() {
 	done
 }
 _python_set_globals
+
+# @FUNCTION: python_get_PYTHON
+# @USAGE: <impl>
+# @DESCRIPTION:
+# Get the Python executable name for the given implementation.
+python_get_PYTHON() {
+	local impl=${1/_/.}
+
+	case "${impl}" in
+		python*|jython*)
+			echo ${impl}
+			;;
+		pypy*)
+			echo pypy-c${impl#pypy}
+			;;
+		*)
+			die "Invalid argument to python_get_PYTHON: ${1}"
+			;;
+	esac
+}
-- 
1.7.12



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

end of thread, other threads:[~2012-09-24 21:11 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-19 10:00 [gentoo-dev] [PATCH 1/6] Drop pointless default S assignment Michał Górny
2012-09-19 10:00 ` [gentoo-dev] [PATCH 2/6] Move EXPORT_FUNCTIONS after the EAPI switch Michał Górny
2012-09-19 10:00 ` [gentoo-dev] [PATCH 3/6] Temporarily remove PYTHON_OPTIONAL -- it is mis-designed Michał Górny
2012-09-19 10:00 ` [gentoo-dev] [PATCH 4/6] Support PYTHON_COMPAT being an array Michał Górny
2012-09-19 10:00 ` [gentoo-dev] [PATCH 5/6] Move PYTHON_COMPAT, IUSE and REQUIRED_USE to python-r1 Michał Górny
2012-09-19 10:00 ` [gentoo-dev] [PATCH 6/6] Generate python depstrings in python-r1 Michał Górny
2012-09-19 13:00   ` Ian Stakenvicius
2012-09-19 17:37     ` Michał Górny
2012-09-19 17:58       ` Ian Stakenvicius
2012-09-19 18:40         ` Michał Górny
2012-09-19 21:43 ` [gentoo-dev] [PATCH 1/3] Generate python depstrings in python-r1 (updated) Michał Górny
2012-09-19 21:43   ` [gentoo-dev] [PATCH 2/3] Generate PYTHON_USEDEP for use in cross-package deps Michał Górny
2012-09-19 21:43   ` [gentoo-dev] [PATCH 3/3] Support specifying the USE-deps for Python impl Michał Górny
2012-09-22  4:47   ` [gentoo-dev] [PATCH 1/3] Generate python depstrings in python-r1 (updated) Ben de Groot
2012-09-24 21:11 ` [gentoo-dev] [PATCH] python-r1: introduce PYTHON executable getter 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