commit:     5027f7445438287f44cff045ebe4b914fefd0ba9
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Wed Feb  5 02:51:21 2025 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Wed Feb  5 02:53:04 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=5027f744

app-misc/khard: sanitize MAKE for sphinx

Sphinx tries to pass $MAKE to subprocess.call, so something like
MAKE="make -j1" will crash it. I've added a little hack to strip off any
arguments that might be in the user's MAKE before running sphinx.

Closes: https://bugs.gentoo.org/924143
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 app-misc/khard/khard-0.19.1.ebuild | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/app-misc/khard/khard-0.19.1.ebuild 
b/app-misc/khard/khard-0.19.1.ebuild
index cc08e4b2d294..b08734e7e503 100644
--- a/app-misc/khard/khard-0.19.1.ebuild
+++ b/app-misc/khard/khard-0.19.1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -56,7 +56,18 @@ distutils_enable_sphinx docs \
        dev-python/sphinx-autodoc-typehints
 
 python_compile_all() {
-       use doc && emake -j1 -C doc/ html text man info
+       if use doc; then
+               # The safe_MAKE= assignment below strips any arguments you might
+               # have in your $MAKE variable (i.e. it keeps only the stuff
+               # before the first space character). Sphinx tries to execute
+               # $MAKE using subprocess.call, which is expecting an actual
+               # program and not a program plus flags. This can help in some
+               # corner cases, like MAKE="make LIBTOOL=..." in make.conf, and
+               # should still allow e.g. MAKE=/usr/local/bin/mymake
+               local safe_MAKE="${MAKE%% *}"
+               [[ -z "${safe_MAKE}" ]] && safe_MAKE=make
+               emake MAKE="${safe_MAKE}" -j1 -C doc/ html text man info
+       fi
 }
 
 python_install_all() {

Reply via email to