From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 78A45139694 for ; Sat, 20 May 2017 13:31:54 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A335B21C0AB; Sat, 20 May 2017 13:30:55 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6199621C0A1 for ; Sat, 20 May 2017 13:30:55 +0000 (UTC) Received: from localhost.localdomain (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 7AC643416BD; Sat, 20 May 2017 13:30:53 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: python@gentoo.org, =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH 1/7] distutils-r1.eclass: Reuse python_setup for common phases Date: Sat, 20 May 2017 15:30:38 +0200 Message-Id: <20170520133044.9692-2-mgorny@gentoo.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170520133044.9692-1-mgorny@gentoo.org> References: <20170520133044.9692-1-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Archives-Salt: 8640d178-8bbc-48d5-816a-d46f41b964fc X-Archives-Hash: b7207bd1b61863af70dfe5421c99c7a7 Rewrite the python_*_all() phase running code to reuse python_setup instead of hacking on top of python_foreach_impl. The resulting code is a bit simpler but most importantly, it avoids duplication of code from python-r1 and ensures that distutils-r1 common phases are directly altered by changes in python_setup. The code still needs to reimplement some of the internals. However, it is mostly limited to code specific to distutils-r1, and should be more maintainable. --- eclass/distutils-r1.eclass | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass index e79f86bab12d..167af95eaed6 100644 --- a/eclass/distutils-r1.eclass +++ b/eclass/distutils-r1.eclass @@ -672,20 +672,20 @@ distutils-r1_run_phase() { _distutils-r1_run_common_phase() { local DISTUTILS_ORIG_BUILD_DIR=${BUILD_DIR} - if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then - local best_impl patterns=( "${DISTUTILS_ALL_SUBPHASE_IMPLS[@]-*}" ) - _distutils_try_impl() { - if _python_impl_matches "${EPYTHON}" "${patterns[@]}"; then - best_impl=${MULTIBUILD_VARIANT} - fi - } - python_foreach_impl _distutils_try_impl - unset -f _distutils_try_impl - - local PYTHON_COMPAT=( "${best_impl}" ) + if [[ ${DISTUTILS_SINGLE_IMPL} ]]; then + # reuse the dedicated code branch + _distutils-r1_run_foreach_impl "${@}" + else + local -x EPYTHON PYTHON + local -x PATH=${PATH} PKG_CONFIG_PATH=${PKG_CONFIG_PATH} + python_setup "${DISTUTILS_ALL_SUBPHASE_IMPLS[@]}" + + local MULTIBUILD_VARIANTS=( "${EPYTHON/./_}" ) + # store for restoring after distutils-r1_run_phase. + local _DISTUTILS_INITIAL_CWD=${PWD} + multibuild_foreach_variant \ + distutils-r1_run_phase "${@}" fi - - _distutils-r1_run_foreach_impl "${@}" } # @FUNCTION: _distutils-r1_run_foreach_impl -- 2.13.0