* pygnulib/GLTestDir.py (GLMegaTestDir.execute): Use a separate set to
remove duplicates from the original list without sorting.
+2024-04-27 Bruno Haible <bruno@clisp.org>
+
+ gnulib-tool: Simplify the Python version test.
+ Suggested by Pádraig Brady in
+ <https://lists.gnu.org/archive/html/bug-gnulib/2024-04/msg00469.html>.
+ * gnulib-tool: Use Python's sys.version_info, not --version.
+ * gnulib-tool.py: Use the same version test here. Use --version only to
+ produce a specific error message.
+
2024-04-27 Bruno Haible <bruno@clisp.org>
fcntl-h, stdio, unistd: Ensure off64_t is defined on all platforms.
'')
# 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
+ if (python3 -c 'import sys; sys.exit(not sys.version_info >= (3,7))') 2>/dev/null; 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
func_gnulib_dir
# Check the Python version.
-if (python3 --version) >/dev/null 2>/dev/null; then
- case `python3 --version 2>&1` in
- Python\ 3.[0-6] | Python\ 3.[0-6].*)
- func_fatal_error "python3 is too old (minimum required version is 3.7); try setting GNULIB_TOOL_IMPL=sh" ;;
- Python\ 3.*)
- ;;
- *)
- func_fatal_error "python3 version is unsupported" ;;
- esac
+if (python3 -c 'import sys; sys.exit(not sys.version_info >= (3,7))') 2>/dev/null; then
+ :
else
- func_fatal_error "python3 not found; try setting GNULIB_TOOL_IMPL=sh"
+ if (python3 --version) >/dev/null 2>/dev/null; then
+ case `python3 --version 2>&1` in
+ Python\ 3.[0-6] | Python\ 3.[0-6].*)
+ func_fatal_error "python3 is too old (minimum required version is 3.7); try setting GNULIB_TOOL_IMPL=sh" ;;
+ Python\ 3.*)
+ ;;
+ *)
+ func_fatal_error "python3 version is unsupported" ;;
+ esac
+ else
+ func_fatal_error "python3 not found; try setting GNULIB_TOOL_IMPL=sh"
+ fi
fi
# Tell Python to store the compiled bytecode outside the gnulib directory.