Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 955709 - dev-libs/newt-0.52.25-r1[-python]: configure fails with "No supported Python implementation in PYTHON_TARGETS."
Summary: dev-libs/newt-0.52.25-r1[-python]: configure fails with "No supported Python ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Ben Kohler
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-05-10 03:22 UTC by Matt Whitlock
Modified: 2025-05-11 06:41 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Whitlock 2025-05-10 03:22:44 UTC
/etc/portage/package.use:

    dev-libs/newt -python PYTHON_TARGETS: -*

Then emerge:

>>> Configuring source in /var/tmp/portage/dev-libs/newt-0.52.25-r1/work/newt-r0-52-25 ...
 * No Python implementation selected for the build. Please add one
 * of the following values to your PYTHON_TARGETS (in make.conf):
 * 
 * python3_11 python3_12 python3_13

 * ERROR: dev-libs/newt-0.52.25-r1::gentoo failed (configure phase):
 *   No supported Python implementation in PYTHON_TARGETS.
 * 
 * Call stack:
 *     ebuild.sh, line  136:  Called src_configure
 *   environment, line 2126:  Called python_foreach_impl 'getversions'
 *   environment, line 1819:  Called _python_obtain_impls
 *   environment, line  626:  Called _python_validate_useflags
 *   environment, line  773:  Called die
 * The specific snippet of code:
 *       die "No supported Python implementation in PYTHON_TARGETS."

The failure occurs because the ebuild's src_configure() calls python_foreach_impl *unconditionally* despite that REQUIRED_USE only *conditionally* requires ${PYTHON_REQUIRED_USE}.

It actually looks like the changes that were made in -r1 inadvertently abandoned the ${versions} variable that is built up by the python_foreach_impl loop. And now, worse, even with Python enabled, Newt gets configured without any(!) Python versions because EPYTHON is unset at the point of the call to econf.

I think this was the intention:

src_configure() {
    local -a versions
    if use python; then
        getversions() {
            versions+=("${EPYTHON}")
        }
        python_foreach_impl getversions
    fi

    econf \
        "$(use_with python '' "${versions[*]}")" \
        $(use_with gpm gpm-support) \
        $(use_with tcl) \
        $(use_enable nls)
}

Note: The double-quotes around the "$(use_with python …)" command substitution are important because the argument will have embedded spaces when multiple Python versions are enabled, but it all needs to be passed to econf as a single argument.
Comment 1 Eli Schwartz gentoo-dev 2025-05-11 04:33:38 UTC
(In reply to Matt Whitlock from comment #0)
> /etc/portage/package.use:
> 
>     dev-libs/newt -python PYTHON_TARGETS: -*
> 
> Then emerge:
> 
> >>> Configuring source in /var/tmp/portage/dev-libs/newt-0.52.25-r1/work/newt-r0-52-25 ...
>  * No Python implementation selected for the build. Please add one
>  * of the following values to your PYTHON_TARGETS (in make.conf):
>  * 
>  * python3_11 python3_12 python3_13
> 
>  * ERROR: dev-libs/newt-0.52.25-r1::gentoo failed (configure phase):
>  *   No supported Python implementation in PYTHON_TARGETS.
>  * 
>  * Call stack:
>  *     ebuild.sh, line  136:  Called src_configure
>  *   environment, line 2126:  Called python_foreach_impl 'getversions'
>  *   environment, line 1819:  Called _python_obtain_impls
>  *   environment, line  626:  Called _python_validate_useflags
>  *   environment, line  773:  Called die
>  * The specific snippet of code:
>  *       die "No supported Python implementation in PYTHON_TARGETS."
> 
> The failure occurs because the ebuild's src_configure() calls
> python_foreach_impl *unconditionally* despite that REQUIRED_USE only
> *conditionally* requires ${PYTHON_REQUIRED_USE}.


Yes, that's a forgotten call to `use python &&`. Note, strictly speaking it doesn't matter if the function is defined anyway.


> It actually looks like the changes that were made in -r1 inadvertently
> abandoned the ${versions} variable that is built up by the
> python_foreach_impl loop. And now, worse, even with Python enabled, Newt
> gets configured without any(!) Python versions because EPYTHON is unset at
> the point of the call to econf.


That feels like a rebase error and I feeling very confused now. :(


> Note: The double-quotes around the "$(use_with python …)" command
> substitution are important because the argument will have embedded spaces
> when multiple Python versions are enabled, but it all needs to be passed to
> econf as a single argument.


It remains unbelievably frustrating that elements with spaces in them are not correctly reported by econf / edo / things of that similar nature.
Comment 2 Larry the Git Cow gentoo-dev 2025-05-11 06:41:05 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=314c1a45c6d0249caed3c81ea1b7501c74e84298

commit 314c1a45c6d0249caed3c81ea1b7501c74e84298
Author:     Eli Schwartz <eschwartz@gentoo.org>
AuthorDate: 2025-05-11 04:35:16 +0000
Commit:     Eli Schwartz <eschwartz@gentoo.org>
CommitDate: 2025-05-11 06:40:33 +0000

    dev-libs/newt: fix python optionality
    
    - we can't call python_foreach_impl if all targets are unset, which is
      permitted if python is optional
    - somehow I switched back to calling with EPYTHON instead of versions,
      this was plainly wrong
    - $(use_with) *must* be additionally quoted if withval itself is quoted
      and contains spaces, or we lose the spaces again
    
    Closes: https://bugs.gentoo.org/955709
    Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>

 dev-libs/newt/newt-0.52.25-r1.ebuild | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)