configure: Update the required Python version to 3.11

Updates the configure script to explicitly require the same version of
Python as mentioned as the baseline in the README. This is for both the
version required for building and the version for pyuno.

All versions less than 3.9 are already end-of-life and version 3.11 is
currently in security-fix-only mode so it is probably quite reasonable
to require that.

Previously the configure script only checked for version 3.3, or 3.7 if
internal Harfbuzz is being used. In practice it probably hasn’t worked
to build with anything less than 3.6 since desktop-translate.py started
using f-strings in 2022.

Change-Id: Ice26324f4e7805bc37a0dd07d984451460529249
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/206368
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Neil Roberts <nroberts@libreoffice.org>
This commit is contained in:
Neil Roberts
2026-06-19 15:58:00 +02:00
parent e7ce2c3114
commit 39cb96f0b6
+8 -21
View File
@@ -6315,7 +6315,7 @@ if test "$cross_compiling" = "yes"; then
# similarly: at least skia headers need to be available in the cross-toolset
test "${PLATFORMID}" = "windows_aarch64" && sub_conf_opts="$sub_conf_opts --enable-openssl --with-tls=openssl --enable-skia"
# cross-compilations don't necessarily enable python support in the product/the sub-configure needs to know
# that the minimum supported python version is 3.7 or later...
# that the minimum supported python version is 3.11 or later...
test "$with_system_harfbuzz" != "yes" && sub_conf_opts="$sub_conf_opts NEED_MESON=TRUE"
# Don't bother having configure look for stuff not needed for the build platform anyway
@@ -10594,7 +10594,7 @@ AC_SUBST(LIBXML_LIBS)
AC_SUBST(XMLLINT)
# =====================================================================
# Checking for a Python interpreter with version >= 3.3 (or 3.7 if the build needs meson)
# Checking for a Python interpreter with version >= 3.11
# Optionally user can pass an option to configure, i. e.
# ./configure PYTHON=/usr/bin/python
# =====================================================================
@@ -10608,12 +10608,7 @@ if test "$build_os" != "cygwin" -a "$enable_python" != fully-internal; then
PYTHON_FOR_BUILD=$PYTHON
else
# This allows a lack of system python with no error, we use internal one in that case.
if test "$with_system_harfbuzz" = "yes"; then
AM_PATH_PYTHON([3.3],, [:])
else
# harfbuzz is built using meson, and current meson requires at least python 3.7
AM_PATH_PYTHON([3.7],, [:])
fi
AM_PATH_PYTHON([3.11],, [:])
# Clean PYTHON_VERSION checked below if cross-compiling
PYTHON_VERSION=""
if test "$PYTHON" != ":"; then
@@ -10655,11 +10650,7 @@ no|disable)
# we actually do check anew.
AC_MSG_RESULT([])
unset PYTHON am_cv_pathless_PYTHON ac_cv_path_PYTHON am_cv_python_version am_cv_python_platform am_cv_python_pythondir am_cv_python_pyexecdir
if test -z "$NEED_MESON"; then
AM_PATH_PYTHON([3.3],, [:])
else
AM_PATH_PYTHON([3.7],, [:])
fi
AM_PATH_PYTHON([3.11],, [:])
AC_MSG_CHECKING([which Python to use for Pyuno])
if test "$PYTHON" = ":"; then
if test -z "$PYTHON_FOR_BUILD"; then
@@ -10707,12 +10698,8 @@ if test $enable_python = system; then
unset PYTHON am_cv_pathless_PYTHON ac_cv_path_PYTHON am_cv_python_version am_cv_python_platform am_cv_python_pythondir am_cv_python_pyexecdir
# This causes an error if no python command is found
# the version found here also sets PYTHON_FOR_BUILD below, so the python picked here
# needs to be suitable for meson/the harfbuzz build
if test "$with_system_harfbuzz" = "yes" -o -n "$NEED_MESON" ; then
AM_PATH_PYTHON([3.7])
else
AM_PATH_PYTHON([3.3])
fi
# needs to be suitable for the build
AM_PATH_PYTHON([3.11])
python_include=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('INCLUDEPY'));"`
python_version=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'));"`
python_libs=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('LIBS'));"`
@@ -10824,10 +10811,10 @@ system)
#include <Python.h>
int main(int argc, char **argv) {
if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3)) return 0;
if ((PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 11)) return 0;
else return 1;
}
]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.3 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
]])],[AC_MSG_RESULT([ok])],[AC_MSG_ERROR([Python >= 3.11 is needed when building with Python 3])],[AC_MSG_RESULT([skipped; cross-compiling])])
AC_LANG_POP(C)
dnl FIXME Check if the Python library can be linked with, too?