commit:     025a6339ffc6f52ac78793b43d0cda01e5c35108
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 22 07:26:04 2022 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Fri Feb 25 15:53:07 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=025a6339

distutils-r1.eclass: Make build-backend getting more reliable

Protect build-backend getter against stray output to stdout.

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

 eclass/distutils-r1.eclass | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/eclass/distutils-r1.eclass b/eclass/distutils-r1.eclass
index f6c797a9684e..d95b9525db40 100644
--- a/eclass/distutils-r1.eclass
+++ b/eclass/distutils-r1.eclass
@@ -939,10 +939,12 @@ _distutils-r1_get_backend() {
                # if pyproject.toml exists, try getting the backend from it
                # NB: this could fail if pyproject.toml doesn't list one
                build_backend=$(
-                       "${EPYTHON}" - <<-EOF 2>/dev/null
+                       "${EPYTHON}" - 3>&1 &>/dev/null <<-EOF
+                               import os
                                import tomli
                                print(tomli.load(open("pyproject.toml", "rb"))
-                                       ["build-system"]["build-backend"])
+                                               
["build-system"]["build-backend"],
+                                       file=os.fdopen(3, "w"))
                        EOF
                )
        fi

Reply via email to