commit:     2168e72d746d34f8babed2e2f57b310742f36bc1
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  6 10:18:01 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Tue Jun  7 06:53:58 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2168e72d

distutils-r1.eclass: Warn about setuptools legacy backend

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 eclass/distutils-r1.eclass | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index db46d64eea4a..5fb97b35fed3 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -1166,7 +1166,7 @@ _distutils-r1_backend_to_key() {
 _distutils-r1_get_backend() {
        debug-print-function ${FUNCNAME} "${@}"
 
-       local build_backend
+       local build_backend legacy_fallback
        if [[ -f pyproject.toml ]]; then
                # if pyproject.toml exists, try getting the backend from it
                # NB: this could fail if pyproject.toml doesn't list one
@@ -1177,6 +1177,7 @@ _distutils-r1_get_backend() {
        then
                # use the legacy setuptools backend as a fallback
                build_backend=setuptools.build_meta:__legacy__
+               legacy_fallback=1
        fi
        if [[ -z ${build_backend} ]]; then
                die "Unable to obtain build-backend from pyproject.toml"
@@ -1202,6 +1203,11 @@ _distutils-r1_get_backend() {
                        poetry.masonry.api)
                                new_backend=poetry.core.masonry.api
                                ;;
+                       setuptools.build_meta:__legacy__)
+                               # this backend should only be used as implicit 
fallback
+                               [[ ! ${legacy_fallback} ]] &&
+                                       new_backend=setuptools.build_meta
+                               ;;
                esac
 
                if [[ -n ${new_backend} ]]; then

Reply via email to