GraphicsMagick: configure.ac: Search for a usable Python program...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.7888.1664061012.1372.graphicsmagick-commit@lists.sourceforge.net>
changeset cac308009035 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=cac308009035
summary: configure.ac: Search for a usable Python program, and then use it to execute Python scripts.

diffstat:

 ChangeLog          |   4 ++++
 Makefile.in        |  13 +++++++------
 configure          |  45 +++++++++++++++++++++++++++++++++++++++++++++
 configure.ac       |   3 +++
 www/Changelog.html |   3 +++
 www/Makefile.am    |  12 ++++++------
 6 files changed, 68 insertions(+), 12 deletions(-)

diffs (184 lines):

diff -r 8a53ac7bbab5 -r cac308009035 ChangeLog
--- a/ChangeLog	Sat Sep 24 17:52:07 2022 -0500
+++ b/ChangeLog	Sat Sep 24 18:09:59 2022 -0500
@@ -1,5 +1,9 @@
 2022-09-24  Bob Friesenhahn  <[email protected]>
 
+	* configure.ac: Search for a usable Python program, and then use
+	it to execute Python scripts. This avoids depending on a default
+	name.
+
 	* magick/common.h (MAGICK_FUNC_MALLOC_2ARG): Add macros to support
 	GCC malloc attributes which accept arguments.
 
diff -r 8a53ac7bbab5 -r cac308009035 Makefile.in
--- a/Makefile.in	Sat Sep 24 17:52:07 2022 -0500
+++ b/Makefile.in	Sat Sep 24 18:09:59 2022 -0500
@@ -2630,6 +2630,7 @@
 PTHREAD_CFLAGS = @PTHREAD_CFLAGS@
 PTHREAD_CXX = @PTHREAD_CXX@
 PTHREAD_LIBS = @PTHREAD_LIBS@
+PYTHON = @PYTHON@
 PrintDelegate = @PrintDelegate@
 QuantumDepth = @QuantumDepth@
 RANLIB = @RANLIB@
@@ -4626,7 +4627,7 @@
 @MAINTAINER_MODE_TRUE@RST2HTMLDECO = $(top_srcdir)/scripts/rst2htmldeco.py
 @MAINTAINER_MODE_TRUE@RELPATH = $(top_srcdir)/scripts/relpath.py
 @MAINTAINER_MODE_TRUE@OMP_DECIMAL_ALIGN = $(top_srcdir)/scripts/omp_decimal_align.py
-@MAINTAINER_MODE_TRUE@RST2HTML_COMMAND = $(RST2HTMLDECO) --cloak-email-addresses --link-stylesheet=docutils-articles.css
+@MAINTAINER_MODE_TRUE@RST2HTML_COMMAND = $(PYTHON) $(RST2HTMLDECO) --cloak-email-addresses --link-stylesheet=docutils-articles.css
 
 #
 # Build HTML version of ChangeLogs
@@ -11082,12 +11083,12 @@
 
 # Build HTML version of RST file
 @MAINTAINER_MODE_TRUE@$(top_srcdir)/www/%.html: $(top_srcdir)/%.txt
-@MAINTAINER_MODE_TRUE@	$(RST2HTMLDECO) --link-stylesheet=`$(RELPATH) $(top_srcdir)/www $@`docutils-articles.css \
-@MAINTAINER_MODE_TRUE@	--url-prefix=`$(RELPATH) $(top_srcdir)/www $@` $< $@
+@MAINTAINER_MODE_TRUE@	$(PYTHON) $(RST2HTMLDECO) --link-stylesheet=`$(RELPATH) $(top_srcdir)/www $@`docutils-articles.css \
+@MAINTAINER_MODE_TRUE@	--url-prefix=`$(PYTHON) $(RELPATH) $(top_srcdir)/www $@` $< $@
 
 @MAINTAINER_MODE_TRUE@$(top_srcdir)/%.html: $(top_srcdir)/%.rst
-@MAINTAINER_MODE_TRUE@	$(RST2HTMLDECO)  --link-stylesheet=`$(RELPATH) $(top_srcdir)/www $@`docutils-articles.css \
-@MAINTAINER_MODE_TRUE@	--url-prefix=`$(RELPATH) $(top_srcdir)/www $@` $< | $(OMP_DECIMAL_ALIGN) > $@
+@MAINTAINER_MODE_TRUE@	$(PYTHON) $(RST2HTMLDECO)  --link-stylesheet=`$(RELPATH) $(top_srcdir)/www $@`docutils-articles.css \
+@MAINTAINER_MODE_TRUE@	--url-prefix=`$(PYTHON) $(RELPATH) $(top_srcdir)/www $@` $< | $(PYTHON) $(OMP_DECIMAL_ALIGN) > $@
 
 @MAINTAINER_MODE_TRUE@$(top_srcdir)/www/Changelog.rst: $(top_srcdir)/ChangeLog
 @MAINTAINER_MODE_TRUE@	$(CHANGELOG2RST) < $^ > $@
@@ -11160,7 +11161,7 @@
 
 # Build color.html
 @MAINTAINER_MODE_TRUE@$(WWWDIR)/color.html : $(NAMED_COLORS)
-@MAINTAINER_MODE_TRUE@	$(NAMED_COLORS) > $@
+@MAINTAINER_MODE_TRUE@	$(PYTHON) $(NAMED_COLORS) > $@
 
 @HasRST2HTML_TRUE@@MAINTAINER_MODE_TRUE@$(WWWAPI_HTML_TARGETS) : $(FORMATCAPI) $(RST2HTMLDECO) $(APIWHATIS) $(top_srcdir)/scripts/html_fragments.py $(top_srcdir)/www/api/Makefile.am $(top_srcdir)/www/api/api_hyperlinks.rst
 
diff -r 8a53ac7bbab5 -r cac308009035 configure
--- a/configure	Sat Sep 24 17:52:07 2022 -0500
+++ b/configure	Sat Sep 24 18:09:59 2022 -0500
@@ -689,6 +689,7 @@
 GRAPHICSMAGICK_SNAPSHOT_COPY
 TXT2HTML
 RST2HTML
+PYTHON
 HasPSDelegate_FALSE
 HasPSDelegate_TRUE
 PrintDelegate
@@ -29534,6 +29535,50 @@
 
 # Tests for programs only used while in maintainer mode
 if test "$MAINT" = '' ; then
+   # Search for a usable Python
+   for ac_prog in python3 python python2
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_PYTHON+:} false; then :
+  $as_echo_n "(cached) " >&6
+else
+  if test -n "$PYTHON"; then
+  ac_cv_prog_PYTHON="$PYTHON" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+    for ac_exec_ext in '' $ac_executable_extensions; do
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_PYTHON="$ac_prog"
+    $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+  done
+IFS=$as_save_IFS
+
+fi
+fi
+PYTHON=$ac_cv_prog_PYTHON
+if test -n "$PYTHON"; then
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PYTHON" >&5
+$as_echo "$PYTHON" >&6; }
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+  test -n "$PYTHON" && break
+done
+
+
    # Test for optional rst2html.py utility and define automake conditional HasRST2HTML if found.
    for ac_prog in rst2html.py rst2html
 do
diff -r 8a53ac7bbab5 -r cac308009035 configure.ac
--- a/configure.ac	Sat Sep 24 17:52:07 2022 -0500
+++ b/configure.ac	Sat Sep 24 18:09:59 2022 -0500
@@ -3150,6 +3150,9 @@
 
 # Tests for programs only used while in maintainer mode
 if test "$MAINT" = '' ; then
+   # Search for a usable Python
+   AC_CHECK_PROGS([PYTHON],[python3 python python2])
+
    # Test for optional rst2html.py utility and define automake conditional HasRST2HTML if found.
    AC_CHECK_PROGS([RST2HTML],[rst2html.py rst2html])
 
diff -r 8a53ac7bbab5 -r cac308009035 www/Changelog.html
--- a/www/Changelog.html	Sat Sep 24 17:52:07 2022 -0500
+++ b/www/Changelog.html	Sat Sep 24 18:09:59 2022 -0500
@@ -38,6 +38,9 @@
 <p>2022-09-24  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
 <blockquote>
 <ul class="simple">
+<li>configure.ac: Search for a usable Python program, and then use
+it to execute Python scripts. This avoids depending on a default
+name.</li>
 <li>magick/common.h (MAGICK_FUNC_MALLOC_2ARG): Add macros to support
 GCC malloc attributes which accept arguments.</li>
 </ul>
diff -r 8a53ac7bbab5 -r cac308009035 www/Makefile.am
--- a/www/Makefile.am	Sat Sep 24 17:52:07 2022 -0500
+++ b/www/Makefile.am	Sat Sep 24 18:09:59 2022 -0500
@@ -253,7 +253,7 @@
 RST2HTMLDECO=$(top_srcdir)/scripts/rst2htmldeco.py
 RELPATH=$(top_srcdir)/scripts/relpath.py
 OMP_DECIMAL_ALIGN=$(top_srcdir)/scripts/omp_decimal_align.py
-RST2HTML_COMMAND = $(RST2HTMLDECO) --cloak-email-addresses --link-stylesheet=docutils-articles.css
+RST2HTML_COMMAND = $(PYTHON) $(RST2HTMLDECO) --cloak-email-addresses --link-stylesheet=docutils-articles.css
 
 $(RST2HTML_TARGETS) : \
 	$(top_srcdir)/scripts/html_fragments.py \
@@ -263,12 +263,12 @@
 
 # Build HTML version of RST file
 $(top_srcdir)/www/%.html: $(top_srcdir)/%.txt
-	$(RST2HTMLDECO) --link-stylesheet=`$(RELPATH) $(top_srcdir)/www $@`docutils-articles.css \
-	--url-prefix=`$(RELPATH) $(top_srcdir)/www $@` $< $@
+	$(PYTHON) $(RST2HTMLDECO) --link-stylesheet=`$(RELPATH) $(top_srcdir)/www $@`docutils-articles.css \
+	--url-prefix=`$(PYTHON) $(RELPATH) $(top_srcdir)/www $@` $< $@
 
 $(top_srcdir)/%.html: $(top_srcdir)/%.rst
-	$(RST2HTMLDECO)  --link-stylesheet=`$(RELPATH) $(top_srcdir)/www $@`docutils-articles.css \
-	--url-prefix=`$(RELPATH) $(top_srcdir)/www $@` $< | $(OMP_DECIMAL_ALIGN) > $@
+	$(PYTHON) $(RST2HTMLDECO)  --link-stylesheet=`$(RELPATH) $(top_srcdir)/www $@`docutils-articles.css \
+	--url-prefix=`$(PYTHON) $(RELPATH) $(top_srcdir)/www $@` $< | $(PYTHON) $(OMP_DECIMAL_ALIGN) > $@
 
 #
 # Build HTML version of ChangeLogs
@@ -346,6 +346,6 @@
 
 # Build color.html
 $(WWWDIR)/color.html : $(NAMED_COLORS)
-	$(NAMED_COLORS) > $@
+	$(PYTHON) $(NAMED_COLORS) > $@
 
 endif # MAINTAINER_MODE
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.