bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: gnulib-tool: Use the Python implementation by default
Date: Fri, 26 Apr 2024 11:48:03 +0200	[thread overview]
Message-ID: <5898887.HAe5CsghHZ@nimes> (raw)

I committed this patch, which activates the Python rewrite of gnulib-tool
for all users who have Python installed, without the need to set any
environment variable. I'll make announcements to info-gnu and planet.gnu.org
soon.

Also I couldn't resist pushing a tag named 'v1.0'. We don't make releases,
but it's an indication that Gnulib is mature now.

Many thanks to Dmitry Selyutin for the ground work in 2012, and to Collin Funk
for the finishing work in the last two months!


2024-04-26  Bruno Haible  <bruno@clisp.org>

	gnulib-tool: Use the Python implementation by default.
	* gnulib-tool: If GNULIB_TOOL_IMPL is not set: Use the Python
	implementation if a suitable 'python3' program is found in $PATH;
	otherwise print a warning and use the shell implementation.

diff --git a/gnulib-tool b/gnulib-tool
index 85b62883c6..441958ae7e 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -140,7 +140,22 @@ func_gnulib_dir ()
 func_gnulib_dir
 
 case "$GNULIB_TOOL_IMPL" in
-  '' | sh)
+  '')
+    # Use the Python implementation if a suitable Python version is found
+    # in $PATH. This is the same Python version test as in gnulib-tool.py.
+    if (python3 --version) >/dev/null 2>/dev/null \
+       && case `python3 --version 2>&1` in
+            Python\ 3.[0-6] | Python\ 3.[0-6].*) false ;;
+            Python\ 3.*) true ;;
+            *) false ;;
+          esac; then
+      exec "$gnulib_dir/gnulib-tool.py" "$@"
+    else
+      echo "gnulib-tool: warning: python3 not found or too old, using the slow shell-based implementation" 1>&2
+      exec "$gnulib_dir/gnulib-tool.sh" "$@"
+    fi
+    ;;
+  sh)
     exec "$gnulib_dir/gnulib-tool.sh" "$@" ;;
   py)
     exec "$gnulib_dir/gnulib-tool.py" "$@" ;;





             reply	other threads:[~2024-04-26  9:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26  9:48 Bruno Haible [this message]
2024-04-26 22:13 ` gnulib-tool: Use the Python implementation by default Collin Funk
2024-04-26 23:12   ` Bruno Haible
2024-04-27 12:17 ` Pádraig Brady
2024-04-27 13:32   ` Bruno Haible
2024-04-27 17:53     ` Pádraig Brady
2024-04-27 18:38       ` Bruno Haible
2024-04-27 17:57     ` Paul Eggert
2024-04-27 18:49       ` Bruno Haible
2024-04-27 20:03         ` Collin Funk
2024-04-27 21:55         ` Paul Eggert
2024-04-29 18:57           ` Dmitry Selyutin
2024-04-29 20:06             ` Bruno Haible
2024-04-29 20:32             ` Collin Funk

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5898887.HAe5CsghHZ@nimes \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).