• [gentoo-dev] [PATCH 0/8] distutils-r1.eclass: dev-python/unittest-or-fa

    From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Wed Apr 9 18:00:01 2025
    Hello,

    Here's another batch of changes to Python eclasses. This time it
    includes four changes:

    1. Fix for DISTUTILS_UPSTREAM_PEP517 when ebuild locally overrides
    DISTUTILS_USE_PEP517. This is a rare case, see the last two commits
    for the workarounds that will no longer be necessary.

    2. Bumping dev-python/setuptools dep. Long story short, upstream
    introduced support for new license syntax in setuptools 77,
    and immediately started scaring people with deprecation warnings
    for the old syntax, so we have a growing number of projects
    requiring >=77. The new version will be ready to go stable
    on Saturday.

    3. Removing the use of dev-python/unittest-or-fail. It was an unittest
    wrapper for Python < 3.12, to make test phase fail if there were
    no tests (e.g. distutils_enable_tests call was wrong, or upstream
    suddenly moved tests on version bump). It is no longer needed for
    Python 3.12+, and since we can reasonably expect people to always
    test with 3.12+, this should catch any mistakes and we do not need
    to go through extra hoops for 3.11.

    4. Add verbose deprecation warnings for `distutils_enable_tests
    setup.py`, and for non-PEP517 builds. These are rather ugly as they
    appear during dependency calculation (hence they need the package
    name explicitly printed). Good news is, the use is almost gone
    from ::gentoo, so they are specifically targeted at overlays.

    PR: https://github.com/gentoo/gentoo/pull/41473


    Michał Górny (8):
    distutils-r1.eclass: Make DISTUTILS_UPSTREAM_PEP517 default-unset
    distutils-r1.eclass: Bump minimum setuptools version
    python-utils-r1.eclass: Remove unittest-or-fail use
    distutils-r1.eclass: Remove unittest-or-fail deps
    distutils-r1.eclass: Add verbose `det setup.py` deprecation warning
    distutils-r1.eclass: Add verbose legacy mode deprecation warning
    dev-python/sqlglot: Remove obsolete hack
    dev-python/blake3: Remove obsolete hack

    dev-python/blake3/blake3-1.0.4.ebuild | 1 -
    dev-python/sqlglot/sqlglot-26.12.1.ebuild | 1 -
    eclass/distutils-r1.eclass | 43 ++++++++++++-----------
    eclass/python-utils-r1.eclass | 8 ++---
    4 files changed, 24 insertions(+), 29 deletions(-)

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Wed Apr 9 18:00:01 2025
    Remove the use of dev-python/unittest-or-fail in favor of using stdlib
    unittest runner for all implementations. While technically the latter
    doesn't error out on "no tests" on Python 3.11 and older, this doesn't
    really matter, because we're going to detect broken invocations while
    testing on 3.12+.

    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/python-utils-r1.eclass | 8 ++------
    1 file changed, 2 insertions(+), 6 deletions(-)

    diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass index affb8e55a50d..79097765167f 100644
    --- a/eclass/python-utils-r1.eclass
    +++ b/eclass/python-utils-r1.eclass
    @@ -1481,7 +1481,7 @@ epytest() {
    # @FUNCTION: eunittest
    # @USAGE: [<args>...]
    # @DESCRIPTION:
    -# Run unit tests using dev-python/unittest-or-fail, passing the standard
    +# Run unit tests using unittest, passing the standard
    # set of options, followed by user-specified options.
    #
    # This command dies on failure and respects nonfatal.
    @@ -1492,11 +1492,7 @@ eunittest() {
    _python_check_occluded_packages

    # unittest fails with "no tests" correctly since Python 3.12
    - local runner=unittest
    - if _python_impl_matches "${EPYTHON}" 3.{9..11}; then
    - runner=unittest_or_fail
    - fi
    - set -- "${EPYTHON}" -m "${runner}" discover -v "${@}"
    + set -- "${EPYTHON}" -m unittest discover -v "${@}"

    echo "${@}" >
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Wed Apr 9 18:10:01 2025
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    dev-python/sqlglot/sqlglot-26.12.1.ebuild | 1 -
    1 file changed, 1 deletion(-)

    diff --git a/dev-python/sqlglot/sqlglot-26.12.1.ebuild b/dev-python/sqlglot/sqlglot-26.12.1.ebuild
    index dfb5ad04a049..e6c62a001c9e 100644
    --- a/dev-python/sqlglot/sqlglot-26.12.1.ebuild
    +++ b/dev-python/sqlglot/sqlglot-26.12.1.ebuild
    @@ -62,7 +62,6 @@ python_compile() {

    if use native-extensions; then
    local DISTUTILS_USE_PEP517=maturin
    - local DISTUTILS_UPSTREAM_PEP517=maturin
    cd sqlglotrs || die
    distutils-r1_python_compile
    cd - >/dev/null || die

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Wed Apr 9 18:10:01 2025
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/distutils-r1.eclass | 7 ++++++-
    1 file changed, 6 insertions(+), 1 deletion(-)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index f863872330c2..9b83d502d142 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -599,7 +599,7 @@ distutils_enable_sphinx() {
    #
    # - pytest: dev-python/pytest
    #
    -# - setup.py: setup.py test (no deps included)
    +# - setup.py: setup.py test (no deps included; deprecated)
    #
    # - unittest: for built-in Python unittest module
    #
    @@ -645,6 +645,11 @@ distutils_enable_tests() {
    fi
    ;;
    setup.py)
    + eqawarn
    + eqawarn "=== ${CATEGORY}/${PF} ==="
    + eqawarn "distutils_enable_tests setup.py is deprecated and will be removed."
    + eqawarn "Please use unittest or pytest instead."
    + eqawarn
    ;;
    unittest)
    ;;

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Wed Apr 9 18:10:01 2025
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    dev-python/blake3/blake3-1.0.4.ebuild | 1 -
    1 file changed, 1 deletion(-)

    diff --git a/dev-python/blake3/blake3-1.0.4.ebuild b/dev-python/blake3/blake3-1.0.4.ebuild
    index 8e042ea0c094..e7420a53224a 100644
    --- a/dev-python/blake3/blake3-1.0.4.ebuild
    +++ b/dev-python/blake3/blake3-1.0.4.ebuild
    @@ -116,7 +116,6 @@ src_prepare() {

    python_compile() {
    local DISTUTILS_USE_PEP517=$(usex rust maturin setuptools)
    - local DISTUTILS_UPSTREAM_PEP517=${DISTUTILS_USE_PEP517}

    if ! use rust; then
    cd c_impl || die

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?@21:1/5 to All on Wed Apr 9 18:10:01 2025
    Signed-off-by: Michał Górny <mgorny@gentoo.org>
    ---
    eclass/distutils-r1.eclass | 17 ++++++++---------
    1 file changed, 8 insertions(+), 9 deletions(-)

    diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
    index 9b83d502d142..8966341f5a10 100644
    --- a/eclass/distutils-r1.eclass
    +++ b/eclass/distutils-r1.eclass
    @@ -388,6 +388,14 @@ _distutils_set_globals() {
    DISTUTILS_DEPS=${bdep}
    readonly DISTUTILS_DEPS
    fi
    + else
    + eqawarn
    + eqawarn "=== ${CATEGORY}/${PF} ==="
    + eqawarn "distutils-r1.eclass legacy mode is deprecated and will be removed."
    + eqawarn "Please migrate your ebuilds to use DISTUTILS_USE_PEP517 (common values"
    + eqawarn "are 'setuptools' for packages using setuptools/distutils,"
    + eqawarn "and 'no' for packages using non-PEP517 build systems)."
    + eqawarn
    fi

    if [[ ! ${DISTUTILS_OPTIONAL} ]]; then
    @@ -980,15 +988,6 @@ distutils-r1_python_prepare_all() {
    if [[ ! ${DISTUTILS_USE_PEP517} ]]; then
    _distutils-r1_disable_ez_setup
    _distutils-r1_handle_pyproject_toml
    -
    - case ${DIST
  • From Bryan Gardiner@21:1/5 to mgorny@gentoo.org on Sat Apr 19 20:40:01 2025
    Hi Michał,

    On Wed, 9 Apr 2025 17:44:20 +0200
    Michał Górny <mgorny@gentoo.org> wrote:

    4. Add verbose deprecation warnings for `distutils_enable_tests
    setup.py`, and for non-PEP517 builds. These are rather ugly as
    they appear during dependency calculation (hence they need the package
    name explicitly printed). Good news is, the use is almost gone
    from ::gentoo, so they are specifically targeted at overlays.

    Does this mean further deprecations to setup.py support are coming
    soon? system76-driver's build process uses setup.py and hasn't seen
    any changes yet to work toward PEP517, so I am wondering how soon
    that's going to be a problem.

    Thanks,
    Bryan

    -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCgAdFiEEKEeHjyeKMp3e+zLyU++8oGPmGDwFAmgD7YwACgkQU++8oGPm GDy85BAAh3n7CCdaAdcwB8ZEsVCUKclw4lP+2zo/rkHiWKHShNLKHzOgOzjqkxoF CLt4LbwR0CQ1gbNZ8ulkIycJQeEmgcpZbeqqcCk5hf5QFUfZqu4b/mp1nnyC5v62 lo8B8taGfa4/CTC2z9BizOl6SALJAAnzOyqilHMlN1AClbHUlpmiiTISWnTUv5YC Er7Fgx/AzEWMOq89ycdM2ktcuH7pR671s6f8Ffws8Z2PGEwwZD+S8YxR4y5vvhm4 kOHQHfkjYYTd9gyL6oeFR0Vm03+1qEP0QvzUAYYk0RIInh6bwj4Ce8gA/ErfGyb1 SO5ainswkB/c3oHMHSUoyxYLXgPSIzwzHITz/ktVlgdh8yP4W9/Q4Jt2WsH3fnFL uhCCJLlE36FoZ3NEDrouoKJNpsGbnBuLJCv8FLiQix7r4JuESALilOPGtm7mDkWk c8YVKztqMDEFOiWZfRGCsJbyaOaVhodvlHI+ts7Q47+q2BG9QZc20/qBMW8F+BAD zywLWnj9KpA2HiS8VtvYDWqiE0rCNdmYNYaLCjUzhyMrWrwKSngC/etgObUauT0j MXCYaQ6IWCdtQr+keKyaUDKlsQwpGwTjiTKYKGhj7DFjpYnEOgLTSWa9lHX9Mmub gWgAptxU3s2v0GPIJ7ved24N7x41AcfUm8+0zaKLgH5FIyw0jvU=
    =yeVO
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From =?UTF-8?Q?Micha=C5=82_G=C3=B3rny?=@21:1/5 to Bryan Gardiner on Sat Apr 19 20:50:01 2025
    On Sat, 2025-04-19 at 11:38 -0700, Bryan Gardiner wrote:
    Hi Michał,

    On Wed, 9 Apr 2025 17:44:20 +0200
    Michał Górny <mgorny@gentoo.org> wrote:

    4. Add verbose deprecation warnings for `distutils_enable_tests
    setup.py`, and for non-PEP517 builds. These are rather ugly as
    they appear during dependency calculation (hence they need the package
    name explicitly printed). Good news is, the use is almost gone
    from ::gentoo, so they are specifically targeted at overlays.

    Does this mean further deprecations to setup.py support are coming
    soon? system76-driver's build process uses setup.py and hasn't seen
    any changes yet to work toward PEP517, so I am wondering how soon
    that's going to be a problem.

    Ebuilds without DISTUTILS_USE_PEP517 are deprecated for a long time
    already, and we will be removing the support entirely soon. However,
    calling esetup.py within PEP517 ebuilds will continue to work until
    setuptools upstream breaks it.

    --
    Best regards,
    Michał Górny


    -----BEGIN PGP SIGNATURE-----

    iQFGBAABCgAwFiEEx2qEUJQJjSjMiybFY5ra4jKeJA4FAmgD70ESHG1nb3JueUBn ZW50b28ub3JnAAoJEGOa2uIyniQOGpgH/1t+We5ua4j5B+0+5pLB71aGizN5ONuN VpdfkwJcQRPhufnqUMosG0Xo4uNUfW1+Gf6PVMdrw2DHJyNJ9qM+JipPusguBxWM IdNqBVC3bUSYrkOnuG1vnjkET6cdbul4h98NgyMnwrg/ZbLjE/kyNLJxYOyhrAD4 zE5haJUDJljvq2OJnvBgZrVOe66PsyVHb2bNjiwau4QZZ1Zs0iwGTV2yMwX3pCZG 7scMgl/QG2sMQitXVxTvzzRa5y3laJsn7yCV4TVaTbIGghYgHA680F/YhQuPbzRZ 0+PBiRdnGTF261yHnbok/H8xt0drofa7v5XgcXyZXcVx+OkcvCBq2pw=
    =vphO
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Bryan Gardiner@21:1/5 to mgorny@gentoo.org on Sat Apr 19 22:10:02 2025
    On Sat, 19 Apr 2025 20:45:21 +0200
    Michał Górny <mgorny@gentoo.org> wrote:

    On Sat, 2025-04-19 at 11:38 -0700, Bryan Gardiner wrote:
    Hi Michał,

    On Wed, 9 Apr 2025 17:44:20 +0200
    Michał Górny <mgorny@gentoo.org> wrote:

    4. Add verbose deprecation warnings for `distutils_enable_tests
    setup.py`, and for non-PEP517 builds. These are rather ugly as
    they appear during dependency calculation (hence they need the
    package name explicitly printed). Good news is, the use is
    almost gone from ::gentoo, so they are specifically targeted at
    overlays.

    Does this mean further deprecations to setup.py support are coming
    soon? system76-driver's build process uses setup.py and hasn't seen
    any changes yet to work toward PEP517, so I am wondering how soon
    that's going to be a problem.

    Ebuilds without DISTUTILS_USE_PEP517 are deprecated for a long time
    already, and we will be removing the support entirely soon. However,
    calling esetup.py within PEP517 ebuilds will continue to work until setuptools upstream breaks it.

    Perfect, I was hoping esetup.py would continue to work. Thanks for the
    quick response.

    - Bryan

    -----BEGIN PGP SIGNATURE-----

    iQIzBAEBCgAdFiEEKEeHjyeKMp3e+zLyU++8oGPmGDwFAmgEAVgACgkQU++8oGPm GDwvpw/9Glt+mJ28TSswYELSuVgb3ObgL275dvpmmQngBO69YMD6fppYZ361e/y0 zDXF+zl6QApzYxA4m2p/XMExrt6i1b4Lte4CkD7kq4hoeirQTBEKA3Y9mZNbePZT ybcFf/JBPLT4tb+kAfHYTorH20b9aJt7ThbGwJZiQftUvp1lkT29NTsElTcmDEYn xbHeMhNzeV+xrSnoM0+M0m+N9okzlGhLxLbPRqRwSMK0n67A/lVMFoYdBrgGT5w0 I/ISoTDkdZkKx75OixoVYusDKplALGqkM8F34HhVs4GXZ4xju4m5suYJccnJN7CD oOIbocmAFlrPA59tPVX4WmJM7pldZHQ5vAa/eZHrFg8jxq/8pXPiaLnirDQy5v1q Mi0RQpyctYnRu6GkU9otcD5JLh7i1PNJWmZk79H0IaeudYT9l1t1BwpaShQiry0v xO619v009UWHSLiNQI2DmULh4iqagLI4do442bvZwkukNhRLwBSGlv9amrXsBS+y c5uayccZ0OAjeBD8ERsbujSyKF6UFnF4y0YXHwtfWFlAPkZXbZlgng5W1Xle5vQk MShWmdhEEUyclDDYfe14xuu5lY/lDaD3CgKph14+8gmxNJyQHP9I7eNAGeW3QMD7 lTU92dbHulW9Tcf6QlIXQ7KrQ3JSa+J8V2VHCz6rD93xYwUQ2eY=
    =rpR3
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)