commit:     579ffa0836ee9943a212862eadb0b27638038316
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Thu Mar 25 02:47:14 2021 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Thu Mar 25 14:35:27 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=579ffa08

sci-mathematics/maxima: don't hard-code the python interpreter.

This is a two-parter to fix bug 766291, which has the build
failing because it can't find "python". First, we patch the
build system to use @PYTHON@ instead of "python" in the one
place upstream missed it. Second, we add python-single-r1 to
the ebuild so that we get $PYTHON set appropriately.

Closes: https://bugs.gentoo.org/766291
Package-Manager: Portage-3.0.13, Repoman-3.0.2
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 .../maxima/files/dont-hardcode-python.patch        | 38 ++++++++++++++++++++++
 ...ma-5.44.0-r1.ebuild => maxima-5.44.0-r2.ebuild} | 21 +++++++++---
 2 files changed, 55 insertions(+), 4 deletions(-)

diff --git a/sci-mathematics/maxima/files/dont-hardcode-python.patch 
b/sci-mathematics/maxima/files/dont-hardcode-python.patch
new file mode 100644
index 00000000000..63dea1ea1de
--- /dev/null
+++ b/sci-mathematics/maxima/files/dont-hardcode-python.patch
@@ -0,0 +1,38 @@
+From a640c5e357ce2aafb6edcba9b6c641cbc7753880 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <[email protected]>
+Date: Wed, 24 Mar 2021 20:57:44 -0400
+Subject: [PATCH 1/1] doc/info/build_html.sh.in: use @PYTHON@ for the python
+ interpreter.
+
+Maxima's ./configure script already detects (or is prodded to use) a
+certain python interpreter. The build_html.sh script, however, is
+still using a hard-coded "python" command. On many systems, "python"
+will be different from the python interpreter that we want to use; for
+example when "python" is python-2.7.x and "python3" is what we want to
+use with Maxima.
+
+This commit tweaks doc/info/build_html.sh.in to use the value of the
+$PYTHON variable instead.
+
+Maxima-Bug: https://sourceforge.net/p/maxima/bugs/3754
+Gentoo-Bug: https://bugs.gentoo.org/766291
+---
+ doc/info/build_html.sh.in | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/doc/info/build_html.sh.in b/doc/info/build_html.sh.in
+index 37930e9..c10e38d 100755
+--- a/doc/info/build_html.sh.in
++++ b/doc/info/build_html.sh.in
+@@ -46,7 +46,7 @@ do
+   echo "filenamebase = \"$filenamebase\""
+   cat $f
+ done | @AWK@ '!/^@c / && !/^@c$/ && (/^@deffn/ || /^@defvr/ || /^@end deffn/ 
|| /^@end defvr/ || /@category/ || /@node/ || /^filenamebase/)' | @SED@ -f 
@abs_srcdir@/extract_categories1.sed | @AWK@ -f 
@abs_srcdir@/extract_categories1.awk > make-categories.py 
+-python make-categories.py 
++@PYTHON@ make-categories.py 
+ @SED@ -e 's/^@bye/@node Documentation Categories, , Function and Variable 
Index\n@chapter Documentation Categories/' @abs_srcdir@/maxima.texi > 
maxima.texi 
+ ( for f in Category-*.texi; do echo '@include' $f; done ; echo @bye ) >> 
maxima.texi 
+ 
+-- 
+2.26.2
+

diff --git a/sci-mathematics/maxima/maxima-5.44.0-r1.ebuild 
b/sci-mathematics/maxima/maxima-5.44.0-r2.ebuild
similarity index 88%
rename from sci-mathematics/maxima/maxima-5.44.0-r1.ebuild
rename to sci-mathematics/maxima/maxima-5.44.0-r2.ebuild
index 4cb02071d12..778b0ba34fb 100644
--- a/sci-mathematics/maxima/maxima-5.44.0-r1.ebuild
+++ b/sci-mathematics/maxima/maxima-5.44.0-r2.ebuild
@@ -3,7 +3,9 @@
 
 EAPI=6
 
-inherit autotools elisp-common eutils flag-o-matic xdg-utils
+PYTHON_COMPAT=( python3_{7,8,9} )
+
+inherit autotools elisp-common eutils flag-o-matic python-single-r1 xdg-utils
 
 DESCRIPTION="Free computer algebra environment based on Macsyma"
 HOMEPAGE="http://maxima.sourceforge.net/";
@@ -72,16 +74,23 @@ done
 
 unset LISP
 
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
 RDEPEND="${RDEPEND}
        ${DEF_DEP}"
 
-DEPEND="${RDEPEND}
+# Python is used in e.g. doc/info/build_html.sh to build the docs.
+DEPEND="${PYTHON_DEPS}
+       ${RDEPEND}
        test? ( sci-visualization/gnuplot )
        sys-apps/texinfo"
 
 TEXMF="${EPREFIX}"/usr/share/texmf-site
 
 pkg_setup() {
+       # Set the PYTHON variable to whatever it should be.
+       python-single-r1_pkg_setup
+
        local n=${#LISPS[*]}
 
        for ((n--; n >= 0; n--)); do
@@ -97,7 +106,7 @@ pkg_setup() {
 
 src_prepare() {
        local n PATCHES v
-       PATCHES=( emacs-0 rmaxima-0 wish-2 xdg-utils-1 )
+       PATCHES=( emacs-0 rmaxima-0 wish-2 xdg-utils-1 dont-hardcode-python )
 
        n=${#PATCHES[*]}
        for ((n--; n >= 0; n--)); do
@@ -148,6 +157,7 @@ src_configure() {
        #   value (expected an integer): 1 -Wl
        #
        # when building the maxima.fas library for ECL.
+       #
        econf ${CONFS} \
                LDFLAGS="$(raw-ldflags)" \
                $(use_with tk wish) \
@@ -156,7 +166,10 @@ src_configure() {
 }
 
 src_compile() {
-       emake
+       # The variable PYTHONBIN is used in one place while building the
+       # German documentation. Some day that script should be converted
+       # to use the value of @PYTHON@ obtained during ./configure.
+       emake PYTHONBIN="${PYTHON}"
        if use emacs; then
                pushd interfaces/emacs/emaxima > /dev/null
                elisp-compile *.el

Reply via email to