On Mon, Nov 5, 2012 at 10:32 AM, Michał Górny <[email protected]> wrote: > On Mon, 5 Nov 2012 10:22:22 -0500 > Mike Gilbert <[email protected]> wrote: > >> On Mon, Nov 5, 2012 at 6:59 AM, Michał Górny <[email protected]> wrote: >> > --- >> > gx86/eclass/python-r1.eclass | 66 >> > ++++++++++++++++++++++++++++++++++++++++++++ >> > 1 file changed, 66 insertions(+) >> > >> > diff --git a/gx86/eclass/python-r1.eclass b/gx86/eclass/python-r1.eclass >> > index 0d6ef4c..6d4eb33 100644 >> > --- a/gx86/eclass/python-r1.eclass >> > +++ b/gx86/eclass/python-r1.eclass >> > @@ -363,6 +363,70 @@ python_copy_sources() { >> > done >> > } >> > >> > +# @FUNCTION: _python_check_USE_PYTHON >> > +# @INTERNAL >> > +# @DESCRIPTION: >> > +# Check whether USE_PYTHON and PYTHON_TARGETS are in sync. Output >> > +# warnings if they are not. >> > +_python_check_USE_PYTHON() { >> > + if [[ ! ${_PYTHON_USE_PYTHON_CHECKED} ]]; then >> > + _PYTHON_USE_PYTHON_CHECKED=1 >> > + >> > + local USE_PYTHON=${USE_PYTHON} >> > + >> > + if [[ ! ${USE_PYTHON} ]]; then >> > + # default to selected Python2+3 >> > + if has_version app-admin/eselect-python; then >> > + local py2=$(eselect python show --python2) >> > + local py3=$(eselect python show --python3) >> > + >> > + USE_PYTHON="${py2#python} ${py3#python}" >> > + fi >> > + fi >> > + >> > + local impl warned >> > + for impl in "${PYTHON_COMPAT[@]}"; do >> > + local abi >> > + case "${impl}" in >> > + python*) >> > + abi=${impl#python} >> > + ;; >> > + jython*) >> > + abi=${impl#jython}-jython >> > + ;; >> > + pypy*) >> > + abi=2.7-pypy-${impl#pypy} >> > + ;; >> > + *) >> > + die "Unexpected Python >> > implementation: ${impl}" >> > + ;; >> > + esac >> > + >> > + has "${abi/_/.}" ${USE_PYTHON} >> > + local has_abi=${?} >> > + use "python_targets_${impl}" >> > + local has_impl=${?} >> > + >> > + if [[ ${has_abi} != ${has_impl} ]]; then >> > + if [[ ! ${warned} ]]; then >> > + ewarn "PYTHON_TARGETS <-> >> > USE_PYTHON inconsistency found. This may result" >> > + ewarn "in missing modules when >> > trying to use Python packages. Please ensure" >> > + ewarn "that the same >> > implementations are listed in both variables." >> > + ewarn >> > + >> > + warned=1 >> > + fi >> > + >> > + if [[ ${has_abi} == 0 ]]; then >> > + ewarn "Implementation ${impl} >> > disabled but ${abi/_/.} in USE_PYTHON" >> > + else >> > + ewarn "Implementation ${impl} >> > enabled but ${abi/_/.} not in USE_PYTHON" >> > + fi >> > + fi >> > + done >> > + fi >> > +} >> > + >> > # @FUNCTION: python_foreach_impl >> > # @USAGE: <command> [<args>...] >> > # @DESCRIPTION: >> > @@ -376,6 +440,8 @@ python_copy_sources() { >> > python_foreach_impl() { >> > debug-print-function ${FUNCNAME} "${@}" >> > >> > + _python_check_USE_PYTHON >> > + >> > local impl >> > local bdir=${BUILD_DIR:-${S}} >> > >> > -- >> > 1.7.12.4 >> > >> >> We should not encourage users to set USE_PYTHON if it has not been set >> already; the variable is pretty much undocumented, and should probably >> stay that way. If USE_PYTHON is unset, we should advise them to update >> PYTHON_TARGETS to match their active python2 and python3 versions >> (from eselect python). > > As in change the output in !USE_PYTHON branch? Something like 'please > set PYTHON_TARGETS or eselect new python'? >
Yep, that sounds good to me.
