axs 14/11/07 15:48:01 Modified: ChangeLog python-single-r1.eclass Log: When only one supported python implementation can satisfy an ebuild, do not provide python_single_target_* flags in IUSE -- effectively, rely only on PYTHON_TARGETS rather than the value specified in PYTHON_SINGLE_TARGET.
Revision Changes Path 1.1405 eclass/ChangeLog file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1405&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?rev=1.1405&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/ChangeLog?r1=1.1404&r2=1.1405 Index: ChangeLog =================================================================== RCS file: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v retrieving revision 1.1404 retrieving revision 1.1405 diff -u -r1.1404 -r1.1405 --- ChangeLog 5 Nov 2014 23:18:07 -0000 1.1404 +++ ChangeLog 7 Nov 2014 15:48:01 -0000 1.1405 @@ -1,6 +1,11 @@ # ChangeLog for eclass directory # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1404 2014/11/05 23:18:07 axs Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1405 2014/11/07 15:48:01 axs Exp $ + + 06 Nov 2014; Ian Stakenvicius <[email protected]> python-single-r1.eclass: + When only one supported python implementation can satisfy an ebuild, do + not provide python_single_target_* flags in IUSE -- effectively, rely + only on PYTHON_TARGETS rather than the value specified in PYTHON_SINGLE_TARGET. 05 Nov 2014; Ian Stakenvicius <[email protected]> mozconfig-v5.33.eclass: Move IUSE=selinux to the eclass 1.27 eclass/python-single-r1.eclass file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-single-r1.eclass?rev=1.27&view=markup plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-single-r1.eclass?rev=1.27&content-type=text/plain diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/python-single-r1.eclass?r1=1.26&r2=1.27 Index: python-single-r1.eclass =================================================================== RCS file: /var/cvsroot/gentoo-x86/eclass/python-single-r1.eclass,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- python-single-r1.eclass 26 May 2014 16:13:35 -0000 1.26 +++ python-single-r1.eclass 7 Nov 2014 15:48:01 -0000 1.27 @@ -1,6 +1,6 @@ # Copyright 1999-2014 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.26 2014/05/26 16:13:35 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/python-single-r1.eclass,v 1.27 2014/11/07 15:48:01 axs Exp $ # @ECLASS: python-single-r1 # @MAINTAINER: @@ -15,8 +15,9 @@ # This mostly includes tools embedding Python. # # This eclass extends the IUSE and REQUIRED_USE set by python-r1 -# to request correct PYTHON_SINGLE_TARGET. It also replaces -# PYTHON_USEDEP and PYTHON_DEPS with a more suitable form. +# to request the PYTHON_SINGLE_TARGET when the inheriting ebuild +# can be supported by more than one Python implementation. It also +# replaces PYTHON_USEDEP and PYTHON_DEPS with a more suitable form. # # Please note that packages support multiple Python implementations # (using python-r1 eclass) can not depend on packages not supporting @@ -136,7 +137,8 @@ # @ECLASS-VARIABLE: PYTHON_REQUIRED_USE # @DESCRIPTION: -# This is an eclass-generated required-use expression which ensures the following: +# This is an eclass-generated required-use expression which ensures the following +# when more than one python implementation is possible: # 1. Exactly one PYTHON_SINGLE_TARGET value has been enabled. # 2. The selected PYTHON_SINGLE_TARGET value is enabled in PYTHON_TARGETS. # @@ -162,15 +164,6 @@ local i PYTHON_PKG_DEP for i in "${PYTHON_COMPAT[@]}"; do _python_impl_supported "${i}" || continue - - # The chosen targets need to be in PYTHON_TARGETS as well. - # This is in order to enforce correct dependencies on packages - # supporting multiple implementations. - PYTHON_REQUIRED_USE+=" python_single_target_${i}? ( python_targets_${i} )" - - python_export "${i}" PYTHON_PKG_DEP - PYTHON_DEPS+="python_single_target_${i}? ( ${PYTHON_PKG_DEP} ) " - impls+=( "${i}" ) done @@ -182,10 +175,38 @@ local flags=( "${impls[@]/#/python_single_target_}" ) local optflags=${flags_mt[@]/%/(-)?} + + IUSE="${flags_mt[*]}" + + if [[ ${#impls[@]} -eq 1 ]]; then + # There is only one supported implementation; set IUSE and other + # variables without PYTHON_SINGLE_TARGET. + PYTHON_REQUIRED_USE="${flags_mt[*]}" + python_export "${impls[0]}" PYTHON_PKG_DEP + PYTHON_DEPS="${PYTHON_PKG_DEP} " + # Force on the python_single_target_* flag for this impl, so + # that any dependencies that inherit python-single-r1 and + # happen to have multiple implementations will still need + # to bound by the implementation used by this package. + optflags+=,${flags[0]/%/(+)} + else + # Multiple supported implementations; honor PYTHON_SINGLE_TARGET. + IUSE+=" ${flags[*]}" + PYTHON_REQUIRED_USE="^^ ( ${flags[*]} )" + # Ensure deps honor the same python_single_target_* flag as is set + # on this package. optflags+=,${flags[@]/%/(+)?} - IUSE="${flags_mt[*]} ${flags[*]}" - PYTHON_REQUIRED_USE+=" ^^ ( ${flags[*]} )" + for i in "${impls[@]}"; do + # The chosen targets need to be in PYTHON_TARGETS as well. + # This is in order to enforce correct dependencies on packages + # supporting multiple implementations. + PYTHON_REQUIRED_USE+=" python_single_target_${i}? ( python_targets_${i} )" + + python_export "${i}" PYTHON_PKG_DEP + PYTHON_DEPS+="python_single_target_${i}? ( ${PYTHON_PKG_DEP} ) " + done + fi PYTHON_USEDEP=${optflags// /,} # 1) well, python-exec would suffice as an RDEP @@ -213,11 +234,21 @@ unset EPYTHON - local impl - for impl in "${_PYTHON_ALL_IMPLS[@]}"; do - if has "${impl}" "${PYTHON_COMPAT[@]}" \ - && use "python_single_target_${impl}" - then + local impl impls=() + for impl in "${PYTHON_COMPAT[@]}"; do + _python_impl_supported "${impl}" || continue + impls+=( "${impl}" ) + done + + if [[ ${#impls[@]} -eq 1 ]]; then + if use "python_targets_${impls[0]}"; then + # Only one supported implementation, enable it explicitly + python_export "${impls[0]}" EPYTHON PYTHON + python_wrapper_setup + fi + else + for impl in "${impls[@]}"; do + if use "python_single_target_${impl}"; then if [[ ${EPYTHON} ]]; then eerror "Your PYTHON_SINGLE_TARGET setting lists more than a single Python" eerror "implementation. Please set it to just one value. If you need" @@ -240,15 +271,20 @@ python_wrapper_setup fi done + fi if [[ ! ${EPYTHON} ]]; then eerror "No Python implementation selected for the build. Please set" + if [[ ${#impls[@]} -eq 1 ]]; then + eerror "the PYTHON_TARGETS variable in your make.conf to include one" + else eerror "the PYTHON_SINGLE_TARGET variable in your make.conf to one" + fi eerror "of the following values:" eerror - eerror "${PYTHON_COMPAT[@]}" + eerror "${impls[@]}" echo - die "No supported Python implementation in PYTHON_SINGLE_TARGET." + die "No supported Python implementation in PYTHON_SINGLE_TARGET/PYTHON_TARGETS." fi }
