diff options
author | Ian Stakenvicius <axs@gentoo.org> | 2014-11-07 15:48:01 +0000 |
---|---|---|
committer | Ian Stakenvicius <axs@gentoo.org> | 2014-11-07 15:48:01 +0000 |
commit | 6f1b5ccb0693d35e54195c52ac833e720347c509 (patch) | |
tree | 640829dcc56dbdc8e5fb64a9bbc809de0571e0a5 /eclass | |
parent | Version bump (diff) | |
download | historical-6f1b5ccb0693d35e54195c52ac833e720347c509.tar.gz historical-6f1b5ccb0693d35e54195c52ac833e720347c509.tar.bz2 historical-6f1b5ccb0693d35e54195c52ac833e720347c509.zip |
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.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ChangeLog | 7 | ||||
-rw-r--r-- | eclass/python-single-r1.eclass | 80 |
2 files changed, 64 insertions, 23 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index 14ad53e6c2d1..c48a568c28d0 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -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 <axs@gentoo.org> 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 <axs@gentoo.org> mozconfig-v5.33.eclass: Move IUSE=selinux to the eclass diff --git a/eclass/python-single-r1.eclass b/eclass/python-single-r1.eclass index c5a8702ee89e..febcae9d7471 100644 --- a/eclass/python-single-r1.eclass +++ b/eclass/python-single-r1.eclass @@ -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 @@ fi # @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 @@ _python_single_set_globals() { 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 @@ _python_single_set_globals() { 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 @@ python_setup() { 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_setup() { 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 } |