From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id B79C81385A3 for ; Sun, 20 Jan 2013 18:30:51 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 3E16621C191; Sun, 20 Jan 2013 18:30:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id ABA0B21C191 for ; Sun, 20 Jan 2013 18:30:50 +0000 (UTC) Received: from [192.168.1.204] (76-230-137-203.lightspeed.livnmi.sbcglobal.net [76.230.137.203]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: floppym) by smtp.gentoo.org (Postfix) with ESMTPSA id 1C78E33DA96; Sun, 20 Jan 2013 18:30:48 +0000 (UTC) Message-ID: <50FC37D6.9060308@gentoo.org> Date: Sun, 20 Jan 2013 13:30:46 -0500 From: Mike Gilbert User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130112 Thunderbird/17.0.2 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Discussions centering around the Python ecosystem in Gentoo Linux X-BeenThere: gentoo-python@gentoo.org X-BeenThere: gentoo-python@lists.gentoo.org MIME-Version: 1.0 To: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= CC: gentoo-python@lists.gentoo.org, python@gentoo.org, maksbotan@gentoo.org, sterkrig@myopera.com Subject: [gentoo-python] Re: [PATCH 3/3] Support requesting single implementation only (python-single-r1). References: <1358677094-20652-1-git-send-email-mgorny@gentoo.org> <1358677094-20652-3-git-send-email-mgorny@gentoo.org> In-Reply-To: <1358677094-20652-3-git-send-email-mgorny@gentoo.org> X-Enigmail-Version: 1.5 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="----enig2DJUMVSXITAUUMEKEKTWR" X-Archives-Salt: ff5b98b0-91e9-4d98-9e45-411ceaae48ce X-Archives-Hash: b0b9e69ec23f1ae22f85d7e52a96e23c This is an OpenPGP/MIME signed message (RFC 4880 and 3156) ------enig2DJUMVSXITAUUMEKEKTWR Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 01/20/2013 05:18 AM, Micha=C5=82 G=C3=B3rny wrote: > --- > gx86/eclass/distutils-r1.eclass | 98 ++++++++++++++++++++++++++++++++-= -------- > 1 file changed, 76 insertions(+), 22 deletions(-) >=20 > diff --git a/gx86/eclass/distutils-r1.eclass b/gx86/eclass/distutils-r1= =2Eeclass > 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. > =20 > +# @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-r= 1 > +# 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 > =20 > -inherit eutils multiprocessing python-r1 > +inherit eutils > + > +if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then > + inherit multiprocessing python-r1 > +else > + inherit python-single-r1 > +fi > =20 > fi > =20 > @@ -237,7 +254,8 @@ distutils-r1_python_prepare_all() { > fi > fi > =20 > - 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 > =20 > local root=3D${D}/_${EPYTHON} > + [[ ${DISTUTILS_SINGLE_IMPL} ]] && root=3D${D} > =20 > esetup.py install "${flags[@]}" --root=3D"${root}" "${@}" > - _distutils-r1_rename_scripts "${root}" > =20 > - _distutils-r1_merge_root "${root}" "${D}" > + if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then > + _distutils-r1_rename_scripts "${root}" > + _distutils-r1_merge_root "${root}" "${D}" > + fi > } > =20 > # @FUNCTION: distutils-r1_merge_root > @@ -431,7 +452,9 @@ distutils-r1_run_phase() { > debug-print-function ${FUNCNAME} "${@}" > =20 > 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=3D"${BUILD_DIR}/lib:${PYTHONPATH}" > export PYTHONPATH > @@ -441,7 +464,8 @@ distutils-r1_run_phase() { > =20 > mkdir -p "${TMPDIR}" || die > =20 > - 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 > =20 > - if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then > + if [[ ${DISTUTILS_IN_SOURCE_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]] > + then > popd &>/dev/null || die > fi > =20 > @@ -487,14 +512,17 @@ _distutils-r1_run_common_phase() { > _distutils-r1_multijob_init() { > debug-print-function ${FUNCNAME} "${@}" > =20 > - local opts > - if [[ ${DISTUTILS_JOBS} ]]; then > - opts=3D-j${DISTUTILS_JOBS} > - else > - opts=3D${MAKEOPTS} > - fi > + if [[ ! ${DISTUTILS_NO_PARALLEL_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} = ]] > + then > + local opts > + if [[ ${DISTUTILS_JOBS} ]]; then > + opts=3D-j${DISTUTILS_JOBS} > + else > + opts=3D${MAKEOPTS} > + fi > =20 > - multijob_init "${opts}" > + multijob_init "${opts}" > + fi > } > =20 > # @FUNCTION: _distutils-r1_multijob_finish > @@ -504,7 +532,33 @@ _distutils-r1_multijob_init() { > _distutils-r1_multijob_finish() { > debug-print-function ${FUNCNAME} "${@}" > =20 > - 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 implementati= ons > +# 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=3D${BUILD_DIR:-${S}} > + BUILD_DIR=3D${BUILD_DIR%%/}_${EPYTHON} > + > + "${@}" > + fi > } > =20 > distutils-r1_src_prepare() { > @@ -519,7 +573,7 @@ distutils-r1_src_prepare() { > =20 > _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 > =20 > @@ -541,9 +595,9 @@ distutils-r1_src_compile() { > =20 > _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_compi= le > + _distutils-r1_run_foreach_impl distutils-r1_python_compile > fi > _distutils-r1_multijob_finish > =20 > @@ -557,7 +611,7 @@ distutils-r1_src_test() { > =20 > _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 > =20 > @@ -571,9 +625,9 @@ distutils-r1_src_install() { > =20 > _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_insta= ll > + _distutils-r1_run_foreach_impl distutils-r1_python_install > fi > _distutils-r1_multijob_finish > =20 >=20 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. ------enig2DJUMVSXITAUUMEKEKTWR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iF4EAREIAAYFAlD8N9YACgkQC77qH+pIQ6TBSwD/cCH78F4nLV58S1g6LzH+AKd6 pl5l5MHKmK7Dwecp74EA/00MyOUe8Q7O6SSN7S55ARKi5hNuKTp8Zm/TGPROHr9I =J0QK -----END PGP SIGNATURE----- ------enig2DJUMVSXITAUUMEKEKTWR--