public inbox for gentoo-python@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-python] [PATCH 1/3] Support making distutils-r1 deps and phases optional.
@ 2013-01-20 10:18 Michał Górny
  2013-01-20 10:18 ` [gentoo-python] [PATCH 2/3] Wrap multijob_finish in a private function as well Michał Górny
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Michał Górny @ 2013-01-20 10:18 UTC (permalink / raw
  To: gentoo-python; +Cc: python, maksbotan, sterkrig, Michał Górny

If a particular package uses distutils part only conditionally
(e.g. with USE=python), you can do something like:

	DISTUTILS_OPTIONAL=1
	RDEPEND="python? ( ${PYTHON_DEPS} )"
	src_compile() { cd python; use python && distutils-r1_src_compile; }
	src_test() { cd python; use python && distutils-r1_src_test; }
	src_install() { cd python; use python && distutils-r1_src_install; }
---
 gx86/eclass/distutils-r1.eclass | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
index 6a062ae..80734c5 100644
--- a/gx86/eclass/distutils-r1.eclass
+++ b/gx86/eclass/distutils-r1.eclass
@@ -54,18 +54,34 @@ case "${EAPI:-0}" in
 		;;
 esac
 
+# @ECLASS-VARIABLE: DISTUTILS_OPTIONAL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If set to a non-null value, distutils part in the ebuild will
+# be considered optional. No dependencies will be added and no phase
+# functions will be exported.
+#
+# If you enable DISTUTILS_OPTIONAL, you have to set proper dependencies
+# for your package (using ${PYTHON_DEPS}) and to either call
+# distutils-r1 default phase functions or call the build system
+# manually.
+
 if [[ ! ${_DISTUTILS_R1} ]]; then
 
 inherit eutils multiprocessing python-r1
 
 fi
 
-EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
+if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
+	EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
+fi
 
 if [[ ! ${_DISTUTILS_R1} ]]; then
 
-RDEPEND=${PYTHON_DEPS}
-DEPEND=${PYTHON_DEPS}
+if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
+	RDEPEND=${PYTHON_DEPS}
+	DEPEND=${PYTHON_DEPS}
+fi
 
 # @ECLASS-VARIABLE: DISTUTILS_JOBS
 # @DEFAULT_UNSET
-- 
1.8.1.1



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

* [gentoo-python] [PATCH 2/3] Wrap multijob_finish in a private function as well.
  2013-01-20 10:18 [gentoo-python] [PATCH 1/3] Support making distutils-r1 deps and phases optional Michał Górny
@ 2013-01-20 10:18 ` Michał Górny
  2013-01-20 10:18 ` [gentoo-python] [PATCH 3/3] Support requesting single implementation only (python-single-r1) Michał Górny
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Michał Górny @ 2013-01-20 10:18 UTC (permalink / raw
  To: gentoo-python; +Cc: python, maksbotan, sterkrig, Michał Górny

---
 gx86/eclass/distutils-r1.eclass | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
index 80734c5..71c2e67 100644
--- a/gx86/eclass/distutils-r1.eclass
+++ b/gx86/eclass/distutils-r1.eclass
@@ -497,6 +497,16 @@ _distutils-r1_multijob_init() {
 	multijob_init "${opts}"
 }
 
+# @FUNCTION: _distutils-r1_multijob_finish
+# @INTERNAL
+# @DESCRIPTION:
+# Finish multijob if used.
+_distutils-r1_multijob_finish() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	multijob_finish
+}
+
 distutils-r1_src_prepare() {
 	debug-print-function ${FUNCNAME} "${@}"
 
@@ -511,7 +521,7 @@ distutils-r1_src_prepare() {
 	if declare -f python_prepare >/dev/null; then
 		python_foreach_impl distutils-r1_run_phase python_prepare
 	fi
-	multijob_finish
+	_distutils-r1_multijob_finish
 }
 
 distutils-r1_src_configure() {
@@ -519,7 +529,7 @@ distutils-r1_src_configure() {
 	if declare -f python_configure >/dev/null; then
 		python_foreach_impl distutils-r1_run_phase python_configure
 	fi
-	multijob_finish
+	_distutils-r1_multijob_finish
 
 	if declare -f python_configure_all >/dev/null; then
 		_distutils-r1_run_common_phase python_configure_all
@@ -535,7 +545,7 @@ distutils-r1_src_compile() {
 	else
 		python_foreach_impl distutils-r1_run_phase distutils-r1_python_compile
 	fi
-	multijob_finish
+	_distutils-r1_multijob_finish
 
 	if declare -f python_compile_all >/dev/null; then
 		_distutils-r1_run_common_phase python_compile_all
@@ -549,7 +559,7 @@ distutils-r1_src_test() {
 	if declare -f python_test >/dev/null; then
 		python_foreach_impl distutils-r1_run_phase python_test
 	fi
-	multijob_finish
+	_distutils-r1_multijob_finish
 
 	if declare -f python_test_all >/dev/null; then
 		_distutils-r1_run_common_phase python_test_all
@@ -565,7 +575,7 @@ distutils-r1_src_install() {
 	else
 		python_foreach_impl distutils-r1_run_phase distutils-r1_python_install
 	fi
-	multijob_finish
+	_distutils-r1_multijob_finish
 
 	if declare -f python_install_all >/dev/null; then
 		_distutils-r1_run_common_phase python_install_all
-- 
1.8.1.1



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

* [gentoo-python] [PATCH 3/3] Support requesting single implementation only (python-single-r1).
  2013-01-20 10:18 [gentoo-python] [PATCH 1/3] Support making distutils-r1 deps and phases optional Michał Górny
  2013-01-20 10:18 ` [gentoo-python] [PATCH 2/3] Wrap multijob_finish in a private function as well Michał Górny
@ 2013-01-20 10:18 ` Michał Górny
  2013-01-20 18:30   ` [gentoo-python] " Mike Gilbert
  2013-01-20 18:19 ` [gentoo-python] Re: [PATCH 1/3] Support making distutils-r1 deps and phases optional Mike Gilbert
  2013-01-21  6:17 ` Nikolaj Sjujskij
  3 siblings, 1 reply; 8+ messages in thread
From: Michał Górny @ 2013-01-20 10:18 UTC (permalink / raw
  To: gentoo-python; +Cc: python, maksbotan, sterkrig, Michał Górny

---
 gx86/eclass/distutils-r1.eclass | 98 ++++++++++++++++++++++++++++++++---------
 1 file changed, 76 insertions(+), 22 deletions(-)

diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
index 71c2e67..7c6ace4 100644
--- a/gx86/eclass/distutils-r1.eclass
+++ b/gx86/eclass/distutils-r1.eclass
@@ -66,9 +66,26 @@ esac
 # distutils-r1 default phase functions or call the build system
 # manually.
 
+# @ECLASS-VARIABLE: DISTUTILS_SINGLE_IMPL
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# If set to a non-null value, the ebuild will support setting a single
+# Python implementation only. It will effectively replace the python-r1
+# eclass inherit with python-single-r1.
+#
+# Note that inheriting python-single-r1 will cause pkg_setup()
+# to be exported. It must be run in order for the eclass functions
+# to function properly.
+
 if [[ ! ${_DISTUTILS_R1} ]]; then
 
-inherit eutils multiprocessing python-r1
+inherit eutils
+
+if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+	inherit multiprocessing python-r1
+else
+	inherit python-single-r1
+fi
 
 fi
 
@@ -237,7 +254,8 @@ distutils-r1_python_prepare_all() {
 		fi
 	fi
 
-	if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
+	if [[ ${DISTUTILS_IN_SOURCE_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]]
+	then
 		# create source copies for each implementation
 		python_copy_sources
 	fi
@@ -345,11 +363,14 @@ distutils-r1_python_install() {
 	addpredict /usr/lib/portage/pym
 
 	local root=${D}/_${EPYTHON}
+	[[ ${DISTUTILS_SINGLE_IMPL} ]] && root=${D}
 
 	esetup.py install "${flags[@]}" --root="${root}" "${@}"
-	_distutils-r1_rename_scripts "${root}"
 
-	_distutils-r1_merge_root "${root}" "${D}"
+	if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+		_distutils-r1_rename_scripts "${root}"
+		_distutils-r1_merge_root "${root}" "${D}"
+	fi
 }
 
 # @FUNCTION: distutils-r1_merge_root
@@ -431,7 +452,9 @@ distutils-r1_run_phase() {
 	debug-print-function ${FUNCNAME} "${@}"
 
 	if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
-		pushd "${BUILD_DIR}" &>/dev/null || die
+		if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+			pushd "${BUILD_DIR}" &>/dev/null || die
+		fi
 	else
 		local PYTHONPATH="${BUILD_DIR}/lib:${PYTHONPATH}"
 		export PYTHONPATH
@@ -441,7 +464,8 @@ distutils-r1_run_phase() {
 
 	mkdir -p "${TMPDIR}" || die
 
-	if [[ ${DISTUTILS_NO_PARALLEL_BUILD} ]]; then
+	if [[ ${DISTUTILS_NO_PARALLEL_BUILD} || ${DISTUTILS_SINGLE_IMPL} ]]
+	then
 		"${@}" 2>&1 | tee -a "${T}/build-${EPYTHON}.log"
 	else
 		(
@@ -451,7 +475,8 @@ distutils-r1_run_phase() {
 		multijob_post_fork
 	fi
 
-	if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
+	if [[ ${DISTUTILS_IN_SOURCE_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]]
+	then
 		popd &>/dev/null || die
 	fi
 
@@ -487,14 +512,17 @@ _distutils-r1_run_common_phase() {
 _distutils-r1_multijob_init() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	local opts
-	if [[ ${DISTUTILS_JOBS} ]]; then
-		opts=-j${DISTUTILS_JOBS}
-	else
-		opts=${MAKEOPTS}
-	fi
+	if [[ ! ${DISTUTILS_NO_PARALLEL_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]]
+	then
+		local opts
+		if [[ ${DISTUTILS_JOBS} ]]; then
+			opts=-j${DISTUTILS_JOBS}
+		else
+			opts=${MAKEOPTS}
+		fi
 
-	multijob_init "${opts}"
+		multijob_init "${opts}"
+	fi
 }
 
 # @FUNCTION: _distutils-r1_multijob_finish
@@ -504,7 +532,33 @@ _distutils-r1_multijob_init() {
 _distutils-r1_multijob_finish() {
 	debug-print-function ${FUNCNAME} "${@}"
 
-	multijob_finish
+	if [[ ! ${DISTUTILS_NO_PARALLEL_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]]
+	then
+		multijob_finish
+	fi
+}
+
+# @FUNCTION: _distutils-r1_run_foreach_impl
+# @INTERNAL
+# @DESCRIPTION:
+# Run the given phase for each implementation if multiple implementations
+# are enabled, once otherwise.
+_distutils-r1_run_foreach_impl() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	set -- distutils-r1_run_phase "${@}"
+
+	if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+		python_foreach_impl "${@}"
+	else
+		if [[ ! ${EPYTHON} ]]; then
+			die "EPYTHON unset, python-single-r1_pkg_setup not called?!"
+		fi
+		local BUILD_DIR=${BUILD_DIR:-${S}}
+		BUILD_DIR=${BUILD_DIR%%/}_${EPYTHON}
+
+		"${@}"
+	fi
 }
 
 distutils-r1_src_prepare() {
@@ -519,7 +573,7 @@ distutils-r1_src_prepare() {
 
 	_distutils-r1_multijob_init
 	if declare -f python_prepare >/dev/null; then
-		python_foreach_impl distutils-r1_run_phase python_prepare
+		_distutils-r1_run_foreach_impl python_prepare
 	fi
 	_distutils-r1_multijob_finish
 }
@@ -527,7 +581,7 @@ distutils-r1_src_prepare() {
 distutils-r1_src_configure() {
 	_distutils-r1_multijob_init
 	if declare -f python_configure >/dev/null; then
-		python_foreach_impl distutils-r1_run_phase python_configure
+		_distutils-r1_run_foreach_impl python_configure
 	fi
 	_distutils-r1_multijob_finish
 
@@ -541,9 +595,9 @@ distutils-r1_src_compile() {
 
 	_distutils-r1_multijob_init
 	if declare -f python_compile >/dev/null; then
-		python_foreach_impl distutils-r1_run_phase python_compile
+		_distutils-r1_run_foreach_impl python_compile
 	else
-		python_foreach_impl distutils-r1_run_phase distutils-r1_python_compile
+		_distutils-r1_run_foreach_impl distutils-r1_python_compile
 	fi
 	_distutils-r1_multijob_finish
 
@@ -557,7 +611,7 @@ distutils-r1_src_test() {
 
 	_distutils-r1_multijob_init
 	if declare -f python_test >/dev/null; then
-		python_foreach_impl distutils-r1_run_phase python_test
+		_distutils-r1_run_foreach_impl python_test
 	fi
 	_distutils-r1_multijob_finish
 
@@ -571,9 +625,9 @@ distutils-r1_src_install() {
 
 	_distutils-r1_multijob_init
 	if declare -f python_install >/dev/null; then
-		python_foreach_impl distutils-r1_run_phase python_install
+		_distutils-r1_run_foreach_impl python_install
 	else
-		python_foreach_impl distutils-r1_run_phase distutils-r1_python_install
+		_distutils-r1_run_foreach_impl distutils-r1_python_install
 	fi
 	_distutils-r1_multijob_finish
 
-- 
1.8.1.1



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

* [gentoo-python] Re: [PATCH 1/3] Support making distutils-r1 deps and phases optional.
  2013-01-20 10:18 [gentoo-python] [PATCH 1/3] Support making distutils-r1 deps and phases optional Michał Górny
  2013-01-20 10:18 ` [gentoo-python] [PATCH 2/3] Wrap multijob_finish in a private function as well Michał Górny
  2013-01-20 10:18 ` [gentoo-python] [PATCH 3/3] Support requesting single implementation only (python-single-r1) Michał Górny
@ 2013-01-20 18:19 ` Mike Gilbert
  2013-01-21  6:17 ` Nikolaj Sjujskij
  3 siblings, 0 replies; 8+ messages in thread
From: Mike Gilbert @ 2013-01-20 18:19 UTC (permalink / raw
  To: Michał Górny; +Cc: gentoo-python, python, maksbotan, sterkrig

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

On 01/20/2013 05:18 AM, Michał Górny wrote:
> If a particular package uses distutils part only conditionally
> (e.g. with USE=python), you can do something like:
> 
> 	DISTUTILS_OPTIONAL=1
> 	RDEPEND="python? ( ${PYTHON_DEPS} )"
> 	src_compile() { cd python; use python && distutils-r1_src_compile; }
> 	src_test() { cd python; use python && distutils-r1_src_test; }
> 	src_install() { cd python; use python && distutils-r1_src_install; }
> ---
>  gx86/eclass/distutils-r1.eclass | 22 +++++++++++++++++++---
>  1 file changed, 19 insertions(+), 3 deletions(-)
> 
> diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
> index 6a062ae..80734c5 100644
> --- a/gx86/eclass/distutils-r1.eclass
> +++ b/gx86/eclass/distutils-r1.eclass
> @@ -54,18 +54,34 @@ case "${EAPI:-0}" in
>  		;;
>  esac
>  
> +# @ECLASS-VARIABLE: DISTUTILS_OPTIONAL
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# If set to a non-null value, distutils part in the ebuild will
> +# be considered optional. No dependencies will be added and no phase
> +# functions will be exported.
> +#
> +# If you enable DISTUTILS_OPTIONAL, you have to set proper dependencies
> +# for your package (using ${PYTHON_DEPS}) and to either call
> +# distutils-r1 default phase functions or call the build system
> +# manually.
> +
>  if [[ ! ${_DISTUTILS_R1} ]]; then
>  
>  inherit eutils multiprocessing python-r1
>  
>  fi
>  
> -EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
> +if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
> +	EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test src_install
> +fi
>  
>  if [[ ! ${_DISTUTILS_R1} ]]; then
>  
> -RDEPEND=${PYTHON_DEPS}
> -DEPEND=${PYTHON_DEPS}
> +if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
> +	RDEPEND=${PYTHON_DEPS}
> +	DEPEND=${PYTHON_DEPS}
> +fi
>  
>  # @ECLASS-VARIABLE: DISTUTILS_JOBS
>  # @DEFAULT_UNSET
> 

Looks ok.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 230 bytes --]

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

* [gentoo-python] Re: [PATCH 3/3] Support requesting single implementation only (python-single-r1).
  2013-01-20 10:18 ` [gentoo-python] [PATCH 3/3] Support requesting single implementation only (python-single-r1) Michał Górny
@ 2013-01-20 18:30   ` Mike Gilbert
  2013-01-20 18:39     ` Michał Górny
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Gilbert @ 2013-01-20 18:30 UTC (permalink / raw
  To: Michał Górny; +Cc: gentoo-python, python, maksbotan, sterkrig

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

On 01/20/2013 05:18 AM, Michał Górny wrote:
> ---
>  gx86/eclass/distutils-r1.eclass | 98 ++++++++++++++++++++++++++++++++---------
>  1 file changed, 76 insertions(+), 22 deletions(-)
> 
> diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1.eclass
> index 71c2e67..7c6ace4 100644
> --- a/gx86/eclass/distutils-r1.eclass
> +++ b/gx86/eclass/distutils-r1.eclass
> @@ -66,9 +66,26 @@ esac
>  # distutils-r1 default phase functions or call the build system
>  # manually.
>  
> +# @ECLASS-VARIABLE: DISTUTILS_SINGLE_IMPL
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# If set to a non-null value, the ebuild will support setting a single
> +# Python implementation only. It will effectively replace the python-r1
> +# eclass inherit with python-single-r1.
> +#
> +# Note that inheriting python-single-r1 will cause pkg_setup()
> +# to be exported. It must be run in order for the eclass functions
> +# to function properly.
> +
>  if [[ ! ${_DISTUTILS_R1} ]]; then
>  
> -inherit eutils multiprocessing python-r1
> +inherit eutils
> +
> +if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
> +	inherit multiprocessing python-r1
> +else
> +	inherit python-single-r1
> +fi
>  
>  fi
>  
> @@ -237,7 +254,8 @@ distutils-r1_python_prepare_all() {
>  		fi
>  	fi
>  
> -	if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
> +	if [[ ${DISTUTILS_IN_SOURCE_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]]
> +	then
>  		# create source copies for each implementation
>  		python_copy_sources
>  	fi
> @@ -345,11 +363,14 @@ distutils-r1_python_install() {
>  	addpredict /usr/lib/portage/pym
>  
>  	local root=${D}/_${EPYTHON}
> +	[[ ${DISTUTILS_SINGLE_IMPL} ]] && root=${D}
>  
>  	esetup.py install "${flags[@]}" --root="${root}" "${@}"
> -	_distutils-r1_rename_scripts "${root}"
>  
> -	_distutils-r1_merge_root "${root}" "${D}"
> +	if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
> +		_distutils-r1_rename_scripts "${root}"
> +		_distutils-r1_merge_root "${root}" "${D}"
> +	fi
>  }
>  
>  # @FUNCTION: distutils-r1_merge_root
> @@ -431,7 +452,9 @@ distutils-r1_run_phase() {
>  	debug-print-function ${FUNCNAME} "${@}"
>  
>  	if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
> -		pushd "${BUILD_DIR}" &>/dev/null || die
> +		if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
> +			pushd "${BUILD_DIR}" &>/dev/null || die
> +		fi
>  	else
>  		local PYTHONPATH="${BUILD_DIR}/lib:${PYTHONPATH}"
>  		export PYTHONPATH
> @@ -441,7 +464,8 @@ distutils-r1_run_phase() {
>  
>  	mkdir -p "${TMPDIR}" || die
>  
> -	if [[ ${DISTUTILS_NO_PARALLEL_BUILD} ]]; then
> +	if [[ ${DISTUTILS_NO_PARALLEL_BUILD} || ${DISTUTILS_SINGLE_IMPL} ]]
> +	then
>  		"${@}" 2>&1 | tee -a "${T}/build-${EPYTHON}.log"
>  	else
>  		(
> @@ -451,7 +475,8 @@ distutils-r1_run_phase() {
>  		multijob_post_fork
>  	fi
>  
> -	if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
> +	if [[ ${DISTUTILS_IN_SOURCE_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]]
> +	then
>  		popd &>/dev/null || die
>  	fi
>  
> @@ -487,14 +512,17 @@ _distutils-r1_run_common_phase() {
>  _distutils-r1_multijob_init() {
>  	debug-print-function ${FUNCNAME} "${@}"
>  
> -	local opts
> -	if [[ ${DISTUTILS_JOBS} ]]; then
> -		opts=-j${DISTUTILS_JOBS}
> -	else
> -		opts=${MAKEOPTS}
> -	fi
> +	if [[ ! ${DISTUTILS_NO_PARALLEL_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]]
> +	then
> +		local opts
> +		if [[ ${DISTUTILS_JOBS} ]]; then
> +			opts=-j${DISTUTILS_JOBS}
> +		else
> +			opts=${MAKEOPTS}
> +		fi
>  
> -	multijob_init "${opts}"
> +		multijob_init "${opts}"
> +	fi
>  }
>  
>  # @FUNCTION: _distutils-r1_multijob_finish
> @@ -504,7 +532,33 @@ _distutils-r1_multijob_init() {
>  _distutils-r1_multijob_finish() {
>  	debug-print-function ${FUNCNAME} "${@}"
>  
> -	multijob_finish
> +	if [[ ! ${DISTUTILS_NO_PARALLEL_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]]
> +	then
> +		multijob_finish
> +	fi
> +}
> +
> +# @FUNCTION: _distutils-r1_run_foreach_impl
> +# @INTERNAL
> +# @DESCRIPTION:
> +# Run the given phase for each implementation if multiple implementations
> +# are enabled, once otherwise.
> +_distutils-r1_run_foreach_impl() {
> +	debug-print-function ${FUNCNAME} "${@}"
> +
> +	set -- distutils-r1_run_phase "${@}"
> +
> +	if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
> +		python_foreach_impl "${@}"
> +	else
> +		if [[ ! ${EPYTHON} ]]; then
> +			die "EPYTHON unset, python-single-r1_pkg_setup not called?!"
> +		fi
> +		local BUILD_DIR=${BUILD_DIR:-${S}}
> +		BUILD_DIR=${BUILD_DIR%%/}_${EPYTHON}
> +
> +		"${@}"
> +	fi
>  }
>  
>  distutils-r1_src_prepare() {
> @@ -519,7 +573,7 @@ distutils-r1_src_prepare() {
>  
>  	_distutils-r1_multijob_init
>  	if declare -f python_prepare >/dev/null; then
> -		python_foreach_impl distutils-r1_run_phase python_prepare
> +		_distutils-r1_run_foreach_impl python_prepare
>  	fi
>  	_distutils-r1_multijob_finish
>  }
> @@ -527,7 +581,7 @@ distutils-r1_src_prepare() {
>  distutils-r1_src_configure() {
>  	_distutils-r1_multijob_init
>  	if declare -f python_configure >/dev/null; then
> -		python_foreach_impl distutils-r1_run_phase python_configure
> +		_distutils-r1_run_foreach_impl python_configure
>  	fi
>  	_distutils-r1_multijob_finish
>  
> @@ -541,9 +595,9 @@ distutils-r1_src_compile() {
>  
>  	_distutils-r1_multijob_init
>  	if declare -f python_compile >/dev/null; then
> -		python_foreach_impl distutils-r1_run_phase python_compile
> +		_distutils-r1_run_foreach_impl python_compile
>  	else
> -		python_foreach_impl distutils-r1_run_phase distutils-r1_python_compile
> +		_distutils-r1_run_foreach_impl distutils-r1_python_compile
>  	fi
>  	_distutils-r1_multijob_finish
>  
> @@ -557,7 +611,7 @@ distutils-r1_src_test() {
>  
>  	_distutils-r1_multijob_init
>  	if declare -f python_test >/dev/null; then
> -		python_foreach_impl distutils-r1_run_phase python_test
> +		_distutils-r1_run_foreach_impl python_test
>  	fi
>  	_distutils-r1_multijob_finish
>  
> @@ -571,9 +625,9 @@ distutils-r1_src_install() {
>  
>  	_distutils-r1_multijob_init
>  	if declare -f python_install >/dev/null; then
> -		python_foreach_impl distutils-r1_run_phase python_install
> +		_distutils-r1_run_foreach_impl python_install
>  	else
> -		python_foreach_impl distutils-r1_run_phase distutils-r1_python_install
> +		_distutils-r1_run_foreach_impl distutils-r1_python_install
>  	fi
>  	_distutils-r1_multijob_finish
>  
> 

This seems reasonable. The obvious pitfall is that we will have to be
careful about using functions from either python-r1 or python-single-r1.

Nit: vapier mentioned in another review that redirecting stderr on pushd
is wrong, and I'm inclined to agree.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 230 bytes --]

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

* Re: [gentoo-python] Re: [PATCH 3/3] Support requesting single implementation only (python-single-r1).
  2013-01-20 18:30   ` [gentoo-python] " Mike Gilbert
@ 2013-01-20 18:39     ` Michał Górny
  2013-01-20 18:47       ` Mike Gilbert
  0 siblings, 1 reply; 8+ messages in thread
From: Michał Górny @ 2013-01-20 18:39 UTC (permalink / raw
  To: Mike Gilbert; +Cc: gentoo-python, python, maksbotan, sterkrig

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

On Sun, 20 Jan 2013 13:30:46 -0500
Mike Gilbert <floppym@gentoo.org> wrote:

> Nit: vapier mentioned in another review that redirecting stderr on pushd
> is wrong, and I'm inclined to agree.

Ah, correct, that's something to fix. pushd/popd does useless output
on stdout, correct?

-- 
Best regards,
Michał Górny

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

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

* Re: [gentoo-python] Re: [PATCH 3/3] Support requesting single implementation only (python-single-r1).
  2013-01-20 18:39     ` Michał Górny
@ 2013-01-20 18:47       ` Mike Gilbert
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Gilbert @ 2013-01-20 18:47 UTC (permalink / raw
  To: Michał Górny; +Cc: gentoo-python, python, maksbotan, sterkrig

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

On 01/20/2013 01:39 PM, Michał Górny wrote:
> On Sun, 20 Jan 2013 13:30:46 -0500
> Mike Gilbert <floppym@gentoo.org> wrote:
> 
>> Nit: vapier mentioned in another review that redirecting stderr on pushd
>> is wrong, and I'm inclined to agree.
> 
> Ah, correct, that's something to fix. pushd/popd does useless output
> on stdout, correct?
> 

Right.


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 230 bytes --]

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

* [gentoo-python] Re: [PATCH 1/3] Support making distutils-r1 deps and phases optional.
  2013-01-20 10:18 [gentoo-python] [PATCH 1/3] Support making distutils-r1 deps and phases optional Michał Górny
                   ` (2 preceding siblings ...)
  2013-01-20 18:19 ` [gentoo-python] Re: [PATCH 1/3] Support making distutils-r1 deps and phases optional Mike Gilbert
@ 2013-01-21  6:17 ` Nikolaj Sjujskij
  3 siblings, 0 replies; 8+ messages in thread
From: Nikolaj Sjujskij @ 2013-01-21  6:17 UTC (permalink / raw
  To: gentoo-python, Michał Górny; +Cc: python, maksbotan

  DISTUTILS_OPTIONAL seems to work fine, tested with  
sci-libs/geographiclib::rion

> If a particular package uses distutils part only conditionally
> (e.g. with USE=python), you can do something like:
>
> 	DISTUTILS_OPTIONAL=1
> 	RDEPEND="python? ( ${PYTHON_DEPS} )"
> 	src_compile() { cd python; use python && distutils-r1_src_compile; }
> 	src_test() { cd python; use python && distutils-r1_src_test; }
> 	src_install() { cd python; use python && distutils-r1_src_install; }
> ---
>  gx86/eclass/distutils-r1.eclass | 22 +++++++++++++++++++---
>  1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/gx86/eclass/distutils-r1.eclass  
> b/gx86/eclass/distutils-r1.eclass
> index 6a062ae..80734c5 100644
> --- a/gx86/eclass/distutils-r1.eclass
> +++ b/gx86/eclass/distutils-r1.eclass
> @@ -54,18 +54,34 @@ case "${EAPI:-0}" in
>  		;;
>  esac
> +# @ECLASS-VARIABLE: DISTUTILS_OPTIONAL
> +# @DEFAULT_UNSET
> +# @DESCRIPTION:
> +# If set to a non-null value, distutils part in the ebuild will
> +# be considered optional. No dependencies will be added and no phase
> +# functions will be exported.
> +#
> +# If you enable DISTUTILS_OPTIONAL, you have to set proper dependencies
> +# for your package (using ${PYTHON_DEPS}) and to either call
> +# distutils-r1 default phase functions or call the build system
> +# manually.
> +
>  if [[ ! ${_DISTUTILS_R1} ]]; then
> inherit eutils multiprocessing python-r1
> fi
> -EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test  
> src_install
> +if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
> +	EXPORT_FUNCTIONS src_prepare src_configure src_compile src_test  
> src_install
> +fi
> if [[ ! ${_DISTUTILS_R1} ]]; then
> -RDEPEND=${PYTHON_DEPS}
> -DEPEND=${PYTHON_DEPS}
> +if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
> +	RDEPEND=${PYTHON_DEPS}
> +	DEPEND=${PYTHON_DEPS}
> +fi
> # @ECLASS-VARIABLE: DISTUTILS_JOBS
>  # @DEFAULT_UNSET


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

end of thread, other threads:[~2013-01-21  6:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-20 10:18 [gentoo-python] [PATCH 1/3] Support making distutils-r1 deps and phases optional Michał Górny
2013-01-20 10:18 ` [gentoo-python] [PATCH 2/3] Wrap multijob_finish in a private function as well Michał Górny
2013-01-20 10:18 ` [gentoo-python] [PATCH 3/3] Support requesting single implementation only (python-single-r1) Michał Górny
2013-01-20 18:30   ` [gentoo-python] " Mike Gilbert
2013-01-20 18:39     ` Michał Górny
2013-01-20 18:47       ` Mike Gilbert
2013-01-20 18:19 ` [gentoo-python] Re: [PATCH 1/3] Support making distutils-r1 deps and phases optional Mike Gilbert
2013-01-21  6:17 ` Nikolaj Sjujskij

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