* [gentoo-python] [PATCH 1/3] Make python-single-r1 stand-alone.
@ 2012-11-28 12:13 Michał Górny
2012-11-28 12:13 ` [gentoo-python] [PATCH 2/3] Disallow using python-r1 & python-single-r1 together Michał Górny
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Michał Górny @ 2012-11-28 12:13 UTC (permalink / raw
To: gentoo-python; +Cc: python, Michał Górny
It's not that good idea to inherit python-r1 there, so let's just make
it work on its own.
Also, duplicate the docs so that people could find them easily.
---
gx86/eclass/python-r1.eclass | 11 ----
gx86/eclass/python-single-r1.eclass | 114 ++++++++++++++++++++++++++++--------
gx86/eclass/python-utils-r1.eclass | 11 ++++
3 files changed, 100 insertions(+), 36 deletions(-)
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index c989690..9a02df3 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -44,17 +44,6 @@ if [[ ! ${_PYTHON_R1} ]]; then
inherit python-utils-r1
-# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
-# @INTERNAL
-# @DESCRIPTION:
-# All supported Python implementations, most preferred last.
-_PYTHON_ALL_IMPLS=(
- jython2_5
- pypy1_8 pypy1_9
- python3_1 python3_2 python3_3
- python2_5 python2_6 python2_7
-)
-
# @ECLASS-VARIABLE: PYTHON_COMPAT
# @REQUIRED
# @DESCRIPTION:
diff --git a/gx86/eclass/python-single-r1.eclass b/gx86/eclass/python-single-r1.eclass
index 1fdf803..3aa350b 100644
--- a/gx86/eclass/python-single-r1.eclass
+++ b/gx86/eclass/python-single-r1.eclass
@@ -23,9 +23,10 @@
# (using python-r1 eclass) can not depend on packages not supporting
# them (using this eclass).
#
-# Also, please note that python-single-r1 will always inherit python-r1
-# as well. Thus, all the variables defined there are relevant
-# to the packages using python-single-r1.
+# Please note that python-r1 will always inherit python-utils-r1 as
+# well. Thus, all the functions defined there can be used
+# in the packages using python-r1, and there is no need ever to inherit
+# both.
#
# For more information, please see the python-r1 Developer's Guide:
# http://www.gentoo.org/proj/en/Python/python-r1/dev-guide.xml
@@ -44,7 +45,7 @@ esac
if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
-inherit python-r1
+inherit python-utils-r1
fi
@@ -52,13 +53,89 @@ EXPORT_FUNCTIONS pkg_setup
if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
+# @ECLASS-VARIABLE: PYTHON_COMPAT
+# @REQUIRED
+# @DESCRIPTION:
+# This variable contains a list of Python implementations the package
+# supports. It must be set before the `inherit' call. It has to be
+# an array.
+#
+# Example:
+# @CODE
+# PYTHON_COMPAT=( python{2_5,2_6,2_7} )
+# @CODE
+if ! declare -p PYTHON_COMPAT &>/dev/null; then
+ die 'PYTHON_COMPAT not declared.'
+fi
+
+# @ECLASS-VARIABLE: PYTHON_REQ_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_REQ_USE="gdbm,ncurses(-)?"
+# @CODE
+#
+# It will cause the Python dependencies to look like:
+# @CODE
+# python_single_target_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
+# implementations listed in PYTHON_COMPAT.
+#
+# The dependency string is conditional on PYTHON_SINGLE_TARGET.
+#
+# Example use:
+# @CODE
+# RDEPEND="${PYTHON_DEPS}
+# dev-foo/mydep"
+# DEPEND="${RDEPEND}"
+# @CODE
+#
+# Example value:
+# @CODE
+# dev-python/python-exec
+# python_single_target_python2_6? ( dev-lang/python:2.6[gdbm] )
+# python_single_target_python2_7? ( dev-lang/python:2.7[gdbm] )
+# @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.
+#
+# The generate USE-flag list is compatible with packages using python-r1,
+# python-single-r1 and python-distutils-ng eclasses. It must not be used
+# on packages using python.eclass.
+#
+# Example use:
+# @CODE
+# RDEPEND="dev-python/foo[${PYTHON_USEDEP}]"
+# @CODE
+#
+# Example value:
+# @CODE
+# python_targets_python2_7?,python_single_target_python2_7(+)?
+# @CODE
+
_python_single_set_globals() {
+ local flags_mt=( "${PYTHON_COMPAT[@]/#/python_targets_}" )
local flags=( "${PYTHON_COMPAT[@]/#/python_single_target_}" )
- local optflags=${flags[@]/%/(+)?}
+ local optflags=${flags_mt[@]/%/?}
+ optflags+=,${flags[@]/%/(+)?}
- IUSE=${flags[*]}
- REQUIRED_USE="^^ ( ${flags[*]} )"
- PYTHON_USEDEP+=,${optflags// /,}
+ IUSE="${flags_mt[*]} ${flags[*]}"
+ REQUIRED_USE="|| ( ${flags_mt[*]} ) ^^ ( ${flags[*]} )"
+ PYTHON_USEDEP=${optflags// /,}
local usestr
[[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]"
@@ -88,6 +165,10 @@ _python_single_set_globals() {
}
_python_single_set_globals
+# @FUNCTION: python-single-r1_pkg_setup
+# @DESCRIPTION:
+# Determine what the selected Python implementation is and set EPYTHON
+# and PYTHON accordingly.
python-single-r1_pkg_setup() {
debug-print-function ${FUNCNAME} "${@}"
@@ -101,20 +182,3 @@ python-single-r1_pkg_setup() {
fi
done
}
-
-# Incompatible python-r1 functions.
-
-python_copy_sources() {
- die "${FUNCNAME} must not be used with python-single-r1 eclass."
-}
-
-python_foreach_impl() {
- die "${FUNCNAME} must not be used with python-single-r1 eclass."
-}
-
-python_export_best() {
- die "${FUNCNAME} must not be used with python-single-r1 eclass."
-}
-
-_PYTHON_SINGLE_R1=1
-fi
diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass
index d8e4b81..113e977 100644
--- a/gx86/eclass/python-utils-r1.eclass
+++ b/gx86/eclass/python-utils-r1.eclass
@@ -40,6 +40,17 @@ if [[ ! ${_PYTHON_UTILS_R1} ]]; then
inherit multilib
+# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
+# @INTERNAL
+# @DESCRIPTION:
+# All supported Python implementations, most preferred last.
+_PYTHON_ALL_IMPLS=(
+ jython2_5
+ pypy1_8 pypy1_9
+ python3_1 python3_2 python3_3
+ python2_5 python2_6 python2_7
+)
+
# @ECLASS-VARIABLE: PYTHON
# @DESCRIPTION:
# The absolute path to the current Python interpreter.
--
1.8.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-python] [PATCH 2/3] Disallow using python-r1 & python-single-r1 together.
2012-11-28 12:13 [gentoo-python] [PATCH 1/3] Make python-single-r1 stand-alone Michał Górny
@ 2012-11-28 12:13 ` Michał Górny
2012-11-28 12:13 ` [gentoo-python] [PATCH 3/3] Initial concept of python-build-r1 eclass Michał Górny
2012-11-28 12:25 ` [gentoo-python] Re: [PATCH 1/3] Make python-single-r1 stand-alone Dirkjan Ochtman
2 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2012-11-28 12:13 UTC (permalink / raw
To: gentoo-python; +Cc: python, Michał Górny
---
gx86/eclass/python-r1.eclass | 4 ++++
gx86/eclass/python-single-r1.eclass | 15 +++++++++++----
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index 9a02df3..c8cfef3 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -42,6 +42,10 @@ esac
if [[ ! ${_PYTHON_R1} ]]; then
+if [[ ${_PYTHON_SINGLE_R1} ]]; then
+ die 'python-r1.eclass can not be used with python-single-r1.eclass.'
+fi
+
inherit python-utils-r1
# @ECLASS-VARIABLE: PYTHON_COMPAT
diff --git a/gx86/eclass/python-single-r1.eclass b/gx86/eclass/python-single-r1.eclass
index 3aa350b..f645513 100644
--- a/gx86/eclass/python-single-r1.eclass
+++ b/gx86/eclass/python-single-r1.eclass
@@ -23,10 +23,10 @@
# (using python-r1 eclass) can not depend on packages not supporting
# them (using this eclass).
#
-# Please note that python-r1 will always inherit python-utils-r1 as
-# well. Thus, all the functions defined there can be used
-# in the packages using python-r1, and there is no need ever to inherit
-# both.
+# Please note that python-single-r1 will always inherit python-utils-r1
+# as well. Thus, all the functions defined there can be used
+# in the packages using python-single-r1, and there is no need ever
+# to inherit both.
#
# For more information, please see the python-r1 Developer's Guide:
# http://www.gentoo.org/proj/en/Python/python-r1/dev-guide.xml
@@ -45,6 +45,10 @@ esac
if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
+if [[ ${_PYTHON_R1} ]]; then
+ die 'python-single-r1.eclass can not be used with python-r1.eclass.'
+fi
+
inherit python-utils-r1
fi
@@ -182,3 +186,6 @@ python-single-r1_pkg_setup() {
fi
done
}
+
+_PYTHON_SINGLE_R1=1
+fi
--
1.8.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-python] [PATCH 3/3] Initial concept of python-build-r1 eclass.
2012-11-28 12:13 [gentoo-python] [PATCH 1/3] Make python-single-r1 stand-alone Michał Górny
2012-11-28 12:13 ` [gentoo-python] [PATCH 2/3] Disallow using python-r1 & python-single-r1 together Michał Górny
@ 2012-11-28 12:13 ` Michał Górny
2012-11-28 12:25 ` [gentoo-python] Re: [PATCH 1/3] Make python-single-r1 stand-alone Dirkjan Ochtman
2 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2012-11-28 12:13 UTC (permalink / raw
To: gentoo-python; +Cc: python, Michał Górny
This eclass handles the build-time-only dependencies on Python. It adds
a one-of dep and finds the best interpreter installed.
---
gx86/eclass/python-build-r1.eclass | 172 ++++++++++++++++++++++++++++++++++++
gx86/eclass/python-r1.eclass | 2 +
gx86/eclass/python-single-r1.eclass | 2 +
3 files changed, 176 insertions(+)
create mode 100644 gx86/eclass/python-build-r1.eclass
diff --git a/gx86/eclass/python-build-r1.eclass b/gx86/eclass/python-build-r1.eclass
new file mode 100644
index 0000000..d5d1ce0
--- /dev/null
+++ b/gx86/eclass/python-build-r1.eclass
@@ -0,0 +1,172 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/python-single-r1.eclass,v 1.4 2012/11/26 10:05:11 mgorny Exp $
+
+# @ECLASS: python-build-r1
+# @MAINTAINER:
+# Michał Górny <mgorny@gentoo.org>
+# Python herd <python@gentoo.org>
+# @AUTHOR:
+# Author: Michał Górny <mgorny@gentoo.org>
+# Based on work of: Krzysztof Pawlik <nelchael@gentoo.org>
+# @BLURB: An eclass for packages having build-time dependency on Python.
+# @DESCRIPTION:
+# A minimal eclass for packages which need to use the Python interpreter
+# at build-time but have no other relevance to Python.
+#
+# This eclass provides a minimal PYTHON_DEPS variable with a dependency
+# string on any of the supported Python implementations. It also exports
+# pkg_setup() which finds the best supported implementation and sets it
+# as the active one.
+#
+# Please note that python-build-r1 will always inherit python-utils-r1
+# as well. Thus, all the functions defined there can be used in the
+# packages using python-build-r1, and there is no need ever to inherit
+# both.
+#
+# For more information, please see the python-r1 Developer's Guide:
+# http://www.gentoo.org/proj/en/Python/python-r1/dev-guide.xml
+
+case "${EAPI:-0}" in
+ 0|1|2|3|4|5)
+ # EAPI=4 needed by python-r1
+ ;;
+ *)
+ die "Unsupported EAPI=${EAPI} (unknown) for ${ECLASS}"
+ ;;
+esac
+
+if [[ ! ${_PYTHON_BUILD_R1} ]]; then
+
+if [[ ${_PYTHON_R1} ]]; then
+ die 'python-build-r1.eclass can not be used with python-r1.eclass.'
+elif [[ ${_PYTHON_SINGLE_R1} ]]; then
+ die 'python-build-r1.eclass can not be used with python-single-r1.eclass.'
+fi
+
+inherit python-utils-r1
+
+fi
+
+EXPORT_FUNCTIONS pkg_setup
+
+if [[ ! ${_PYTHON_BUILD_R1} ]]; then
+
+# @ECLASS-VARIABLE: PYTHON_COMPAT
+# @REQUIRED
+# @DESCRIPTION:
+# This variable contains a list of Python implementations the package
+# supports. It must be set before the `inherit' call. It has to be
+# an array.
+#
+# Example:
+# @CODE
+# PYTHON_COMPAT=( python{2_5,2_6,2_7} )
+# @CODE
+if ! declare -p PYTHON_COMPAT &>/dev/null; then
+ die 'PYTHON_COMPAT not declared.'
+fi
+
+# @ECLASS-VARIABLE: PYTHON_REQ_USE
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# The list of USEflags required to be enabled on the 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_REQ_USE="gdbm,ncurses(-)?"
+# @CODE
+#
+# It will cause the Python dependencies to look like:
+# @CODE
+# || ( dev-lang/python:X.Y[gdbm,ncurses(-)?] ... )
+# @CODE
+
+# @ECLASS-VARIABLE: PYTHON_DEPS
+# @DESCRIPTION:
+# This is an eclass-generated Python dependency string for all
+# implementations listed in PYTHON_COMPAT.
+#
+# Any of the supported interpreters will satisfy the dependency.
+#
+# Example use:
+# @CODE
+# DEPEND="${RDEPEND}
+# ${PYTHON_DEPS}"
+# @CODE
+#
+# Example value:
+# @CODE
+# || ( dev-lang/python:2.7[gdbm]
+# dev-lang/python:2.6[gdbm] )
+# @CODE
+
+_python_build_set_globals() {
+ local usestr
+ [[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]"
+
+ PYTHON_DEPS=
+ local i
+ 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
+
+ local v=${i##*[a-z]}
+ PYTHON_DEPS="${d}:${v/_/.}${usestr} ${PYTHON_DEPS}"
+ fi
+ done
+ PYTHON_DEPS="|| ( ${PYTHON_DEPS})"
+}
+_python_build_set_globals
+
+# @FUNCTION: python-single-r1_pkg_setup
+# @DESCRIPTION:
+# Determine what the best installed (and supported) Python
+# implementation is and set EPYTHON and PYTHON accordingly.
+python-build-r1_pkg_setup() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local i rev_impls=()
+ for i in "${_PYTHON_ALL_IMPLS[@]}"; do
+ if has "${i}" "${PYTHON_COMPAT[@]}"; then
+ rev_impls=( "${i}" "${rev_impls[@]}" )
+ fi
+ done
+
+ for i in "${rev_impls[@]}"; 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]}
+
+ if has_version "${d}:${v/_/.}${usestr}"; then
+ python_export "${i}" EPYTHON PYTHON
+ break
+ fi
+ done
+}
+
+_PYTHON_BUILD_R1=1
+fi
diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
index c8cfef3..0f62473 100644
--- a/gx86/eclass/python-r1.eclass
+++ b/gx86/eclass/python-r1.eclass
@@ -44,6 +44,8 @@ if [[ ! ${_PYTHON_R1} ]]; then
if [[ ${_PYTHON_SINGLE_R1} ]]; then
die 'python-r1.eclass can not be used with python-single-r1.eclass.'
+elif [[ ${_PYTHON_BUILD_R1} ]]; then
+ die 'python-r1.eclass can not be used with python-build-r1.eclass.'
fi
inherit python-utils-r1
diff --git a/gx86/eclass/python-single-r1.eclass b/gx86/eclass/python-single-r1.eclass
index f645513..60c9977 100644
--- a/gx86/eclass/python-single-r1.eclass
+++ b/gx86/eclass/python-single-r1.eclass
@@ -47,6 +47,8 @@ if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
if [[ ${_PYTHON_R1} ]]; then
die 'python-single-r1.eclass can not be used with python-r1.eclass.'
+elif [[ ${_PYTHON_BUILD_R1} ]]; then
+ die 'python-single-r1.eclass can not be used with python-build-r1.eclass.'
fi
inherit python-utils-r1
--
1.8.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [gentoo-python] Re: [PATCH 1/3] Make python-single-r1 stand-alone.
2012-11-28 12:13 [gentoo-python] [PATCH 1/3] Make python-single-r1 stand-alone Michał Górny
2012-11-28 12:13 ` [gentoo-python] [PATCH 2/3] Disallow using python-r1 & python-single-r1 together Michał Górny
2012-11-28 12:13 ` [gentoo-python] [PATCH 3/3] Initial concept of python-build-r1 eclass Michał Górny
@ 2012-11-28 12:25 ` Dirkjan Ochtman
2012-11-28 17:47 ` Michał Górny
2 siblings, 1 reply; 9+ messages in thread
From: Dirkjan Ochtman @ 2012-11-28 12:25 UTC (permalink / raw
To: Michał Górny; +Cc: gentoo-python, Gentoo Python Project
Patches 1 and 2 look good to me. Patch 3 looks like it merits some
higher-level design discussion?
On Wed, Nov 28, 2012 at 1:13 PM, Michał Górny <mgorny@gentoo.org> wrote:
> It's not that good idea to inherit python-r1 there, so let's just make
> it work on its own.
>
> Also, duplicate the docs so that people could find them easily.
> ---
> gx86/eclass/python-r1.eclass | 11 ----
> gx86/eclass/python-single-r1.eclass | 114 ++++++++++++++++++++++++++++--------
> gx86/eclass/python-utils-r1.eclass | 11 ++++
> 3 files changed, 100 insertions(+), 36 deletions(-)
>
> diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass
> index c989690..9a02df3 100644
> --- a/gx86/eclass/python-r1.eclass
> +++ b/gx86/eclass/python-r1.eclass
> @@ -44,17 +44,6 @@ if [[ ! ${_PYTHON_R1} ]]; then
>
> inherit python-utils-r1
>
> -# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
> -# @INTERNAL
> -# @DESCRIPTION:
> -# All supported Python implementations, most preferred last.
> -_PYTHON_ALL_IMPLS=(
> - jython2_5
> - pypy1_8 pypy1_9
> - python3_1 python3_2 python3_3
> - python2_5 python2_6 python2_7
> -)
> -
> # @ECLASS-VARIABLE: PYTHON_COMPAT
> # @REQUIRED
> # @DESCRIPTION:
> diff --git a/gx86/eclass/python-single-r1.eclass b/gx86/eclass/python-single-r1.eclass
> index 1fdf803..3aa350b 100644
> --- a/gx86/eclass/python-single-r1.eclass
> +++ b/gx86/eclass/python-single-r1.eclass
> @@ -23,9 +23,10 @@
> # (using python-r1 eclass) can not depend on packages not supporting
> # them (using this eclass).
> #
> -# Also, please note that python-single-r1 will always inherit python-r1
> -# as well. Thus, all the variables defined there are relevant
> -# to the packages using python-single-r1.
> +# Please note that python-r1 will always inherit python-utils-r1 as
> +# well. Thus, all the functions defined there can be used
> +# in the packages using python-r1, and there is no need ever to inherit
> +# both.
> #
> # For more information, please see the python-r1 Developer's Guide:
> # http://www.gentoo.org/proj/en/Python/python-r1/dev-guide.xml
> @@ -44,7 +45,7 @@ esac
>
> if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
>
> -inherit python-r1
> +inherit python-utils-r1
>
> fi
>
> @@ -52,13 +53,89 @@ EXPORT_FUNCTIONS pkg_setup
>
> if [[ ! ${_PYTHON_SINGLE_R1} ]]; then
>
> +# @ECLASS-VARIABLE: PYTHON_COMPAT
> +# @REQUIRED
> +# @DESCRIPTION:
> +# This variable contains a list of Python implementations the package
> +# supports. It must be set before the `inherit' call. It has to be
> +# an array.
> +#
> +# Example:
> +# @CODE
> +# PYTHON_COMPAT=( python{2_5,2_6,2_7} )
> +# @CODE
> +if ! declare -p PYTHON_COMPAT &>/dev/null; then
> + die 'PYTHON_COMPAT not declared.'
> +fi
> +
> +# @ECLASS-VARIABLE: PYTHON_REQ_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_REQ_USE="gdbm,ncurses(-)?"
> +# @CODE
> +#
> +# It will cause the Python dependencies to look like:
> +# @CODE
> +# python_single_target_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
> +# implementations listed in PYTHON_COMPAT.
> +#
> +# The dependency string is conditional on PYTHON_SINGLE_TARGET.
> +#
> +# Example use:
> +# @CODE
> +# RDEPEND="${PYTHON_DEPS}
> +# dev-foo/mydep"
> +# DEPEND="${RDEPEND}"
> +# @CODE
> +#
> +# Example value:
> +# @CODE
> +# dev-python/python-exec
> +# python_single_target_python2_6? ( dev-lang/python:2.6[gdbm] )
> +# python_single_target_python2_7? ( dev-lang/python:2.7[gdbm] )
> +# @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.
> +#
> +# The generate USE-flag list is compatible with packages using python-r1,
> +# python-single-r1 and python-distutils-ng eclasses. It must not be used
> +# on packages using python.eclass.
> +#
> +# Example use:
> +# @CODE
> +# RDEPEND="dev-python/foo[${PYTHON_USEDEP}]"
> +# @CODE
> +#
> +# Example value:
> +# @CODE
> +# python_targets_python2_7?,python_single_target_python2_7(+)?
> +# @CODE
> +
> _python_single_set_globals() {
> + local flags_mt=( "${PYTHON_COMPAT[@]/#/python_targets_}" )
> local flags=( "${PYTHON_COMPAT[@]/#/python_single_target_}" )
> - local optflags=${flags[@]/%/(+)?}
> + local optflags=${flags_mt[@]/%/?}
> + optflags+=,${flags[@]/%/(+)?}
>
> - IUSE=${flags[*]}
> - REQUIRED_USE="^^ ( ${flags[*]} )"
> - PYTHON_USEDEP+=,${optflags// /,}
> + IUSE="${flags_mt[*]} ${flags[*]}"
> + REQUIRED_USE="|| ( ${flags_mt[*]} ) ^^ ( ${flags[*]} )"
> + PYTHON_USEDEP=${optflags// /,}
>
> local usestr
> [[ ${PYTHON_REQ_USE} ]] && usestr="[${PYTHON_REQ_USE}]"
> @@ -88,6 +165,10 @@ _python_single_set_globals() {
> }
> _python_single_set_globals
>
> +# @FUNCTION: python-single-r1_pkg_setup
> +# @DESCRIPTION:
> +# Determine what the selected Python implementation is and set EPYTHON
> +# and PYTHON accordingly.
> python-single-r1_pkg_setup() {
> debug-print-function ${FUNCNAME} "${@}"
>
> @@ -101,20 +182,3 @@ python-single-r1_pkg_setup() {
> fi
> done
> }
> -
> -# Incompatible python-r1 functions.
> -
> -python_copy_sources() {
> - die "${FUNCNAME} must not be used with python-single-r1 eclass."
> -}
> -
> -python_foreach_impl() {
> - die "${FUNCNAME} must not be used with python-single-r1 eclass."
> -}
> -
> -python_export_best() {
> - die "${FUNCNAME} must not be used with python-single-r1 eclass."
> -}
> -
> -_PYTHON_SINGLE_R1=1
> -fi
> diff --git a/gx86/eclass/python-utils-r1.eclass b/gx86/eclass/python-utils-r1.eclass
> index d8e4b81..113e977 100644
> --- a/gx86/eclass/python-utils-r1.eclass
> +++ b/gx86/eclass/python-utils-r1.eclass
> @@ -40,6 +40,17 @@ if [[ ! ${_PYTHON_UTILS_R1} ]]; then
>
> inherit multilib
>
> +# @ECLASS-VARIABLE: _PYTHON_ALL_IMPLS
> +# @INTERNAL
> +# @DESCRIPTION:
> +# All supported Python implementations, most preferred last.
> +_PYTHON_ALL_IMPLS=(
> + jython2_5
> + pypy1_8 pypy1_9
> + python3_1 python3_2 python3_3
> + python2_5 python2_6 python2_7
> +)
> +
> # @ECLASS-VARIABLE: PYTHON
> # @DESCRIPTION:
> # The absolute path to the current Python interpreter.
> --
> 1.8.0
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-python] Re: [PATCH 1/3] Make python-single-r1 stand-alone.
2012-11-28 12:25 ` [gentoo-python] Re: [PATCH 1/3] Make python-single-r1 stand-alone Dirkjan Ochtman
@ 2012-11-28 17:47 ` Michał Górny
2012-11-28 18:08 ` Dirkjan Ochtman
0 siblings, 1 reply; 9+ messages in thread
From: Michał Górny @ 2012-11-28 17:47 UTC (permalink / raw
To: Dirkjan Ochtman; +Cc: gentoo-python, Gentoo Python Project
[-- Attachment #1: Type: text/plain, Size: 1033 bytes --]
On Wed, 28 Nov 2012 13:25:25 +0100
Dirkjan Ochtman <djc@gentoo.org> wrote:
> Patches 1 and 2 look good to me. Patch 3 looks like it merits some
> higher-level design discussion?
Yes, that's why I sent it here.
Shortly saying, the issue is that some packages (like chromium) need
Python for build-time only but don't install anything related to it.
Giving user the choice of implementation is not really necessary /
relevant there. Therefore, the idea is to provide a minimalistic code
to handle it with least effort possible.
In the simple case, chromium does:
PYTHON_COMPAT=( python{2_6,2_7} )
inherit python-build-r1
DEPEND=${PYTHON_DEPS}
#pkg_setup() {
# python-build-r1_pkg_setup
# ...
#}
and the build completes gracefully.
And the whole effort is necessary to make sure that the active Python
implementation is one supported by package. For example, the above
ebuild would use (or even might pull in) python2 if python3 is active.
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 316 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-python] Re: [PATCH 1/3] Make python-single-r1 stand-alone.
2012-11-28 17:47 ` Michał Górny
@ 2012-11-28 18:08 ` Dirkjan Ochtman
2012-11-28 20:04 ` Michał Górny
0 siblings, 1 reply; 9+ messages in thread
From: Dirkjan Ochtman @ 2012-11-28 18:08 UTC (permalink / raw
To: Michał Górny; +Cc: gentoo-python, Gentoo Python Project
On Wed, Nov 28, 2012 at 6:47 PM, Michał Górny <mgorny@gentoo.org> wrote:
> Shortly saying, the issue is that some packages (like chromium) need
> Python for build-time only but don't install anything related to it.
How many packages like that are there?
Cheers,
Dirkjan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-python] Re: [PATCH 1/3] Make python-single-r1 stand-alone.
2012-11-28 18:08 ` Dirkjan Ochtman
@ 2012-11-28 20:04 ` Michał Górny
2012-11-28 21:17 ` Dirkjan Ochtman
0 siblings, 1 reply; 9+ messages in thread
From: Michał Górny @ 2012-11-28 20:04 UTC (permalink / raw
To: Dirkjan Ochtman; +Cc: gentoo-python, Gentoo Python Project
[-- Attachment #1: Type: text/plain, Size: 689 bytes --]
On Wed, 28 Nov 2012 19:08:53 +0100
Dirkjan Ochtman <djc@gentoo.org> wrote:
> On Wed, Nov 28, 2012 at 6:47 PM, Michał Górny <mgorny@gentoo.org> wrote:
> > Shortly saying, the issue is that some packages (like chromium) need
> > Python for build-time only but don't install anything related to it.
>
> How many packages like that are there?
From genrdeps (with blockers removed from the list):
$ wc -l run build
6554 run
7741 build
So I'd say that's near 1200 candidates. Plus if I called it just
'python-any-r1' (which seems to be a more general name), I think a few
more would get into the list, like portage for example.
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 316 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-python] Re: [PATCH 1/3] Make python-single-r1 stand-alone.
2012-11-28 20:04 ` Michał Górny
@ 2012-11-28 21:17 ` Dirkjan Ochtman
2012-11-28 22:19 ` Michał Górny
0 siblings, 1 reply; 9+ messages in thread
From: Dirkjan Ochtman @ 2012-11-28 21:17 UTC (permalink / raw
To: Michał Górny; +Cc: gentoo-python, Gentoo Python Project
On Wed, Nov 28, 2012 at 9:04 PM, Michał Górny <mgorny@gentoo.org> wrote:
> So I'd say that's near 1200 candidates. Plus if I called it just
> 'python-any-r1' (which seems to be a more general name), I think a few
> more would get into the list, like portage for example.
Huh? Portage requires run-time Python support.
Cheers,
Dirkjan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [gentoo-python] Re: [PATCH 1/3] Make python-single-r1 stand-alone.
2012-11-28 21:17 ` Dirkjan Ochtman
@ 2012-11-28 22:19 ` Michał Górny
0 siblings, 0 replies; 9+ messages in thread
From: Michał Górny @ 2012-11-28 22:19 UTC (permalink / raw
To: Dirkjan Ochtman; +Cc: gentoo-python, Gentoo Python Project
[-- Attachment #1: Type: text/plain, Size: 609 bytes --]
On Wed, 28 Nov 2012 22:17:42 +0100
Dirkjan Ochtman <djc@gentoo.org> wrote:
> On Wed, Nov 28, 2012 at 9:04 PM, Michał Górny <mgorny@gentoo.org> wrote:
> > So I'd say that's near 1200 candidates. Plus if I called it just
> > 'python-any-r1' (which seems to be a more general name), I think a few
> > more would get into the list, like portage for example.
>
> Huh? Portage requires run-time Python support.
That's why the '-any' alternative name. It requires runtime support but
any supported implementation of Python. Therefore, the '|| ()' dep is
fine.
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 316 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2012-11-28 22:17 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-28 12:13 [gentoo-python] [PATCH 1/3] Make python-single-r1 stand-alone Michał Górny
2012-11-28 12:13 ` [gentoo-python] [PATCH 2/3] Disallow using python-r1 & python-single-r1 together Michał Górny
2012-11-28 12:13 ` [gentoo-python] [PATCH 3/3] Initial concept of python-build-r1 eclass Michał Górny
2012-11-28 12:25 ` [gentoo-python] Re: [PATCH 1/3] Make python-single-r1 stand-alone Dirkjan Ochtman
2012-11-28 17:47 ` Michał Górny
2012-11-28 18:08 ` Dirkjan Ochtman
2012-11-28 20:04 ` Michał Górny
2012-11-28 21:17 ` Dirkjan Ochtman
2012-11-28 22:19 ` 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