Update build time Python requirement to 2.8 (cmake edition)

This commit is contained in:
José Matos 2024-06-10 10:33:33 +01:00
parent 1d2f8b94cb
commit b86059ee6d
2 changed files with 7 additions and 18 deletions

View File

@ -924,27 +924,18 @@ unset(PYTHON_VERSION_MAJOR)
unset(PYTHON_VERSION_MINOR) unset(PYTHON_VERSION_MINOR)
unset(PYTHON_VERSION_STRING) unset(PYTHON_VERSION_STRING)
if (CMAKE_VERSION VERSION_LESS "3.13") if (CMAKE_VERSION VERSION_LESS "3.13")
find_package(PythonInterp 3.5 QUIET) find_package(PythonInterp 3.8)
if(NOT PYTHONINTERP_FOUND) if(NOT PYTHONINTERP_FOUND)
find_package(PythonInterp 2.0 REQUIRED) message(FATAL_ERROR "Python interpreter not found or not suitable")
if(NOT PYTHON_VERSION_STRING VERSION_LESS 2.8)
message(FATAL_ERROR "Python interpreter found, but is not suitable")
endif()
endif() endif()
set(LYX_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "Python to be used by LyX") set(LYX_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} CACHE FILEPATH "Python to be used by LyX")
else() else()
find_package(Python3 3.5 QUIET) find_package(Python3 3.8)
if(NOT Python3_Interpreter_FOUND) if(NOT Python3_Interpreter_FOUND)
unset(PYTHON_EXECUTABLE CACHE) message(FATAL_ERROR "Python interpreter not found or not suitable")
find_package(Python2 2.0 REQUIRED)
if(NOT Python2_VERSION VERSION_LESS 2.8)
message(FATAL_ERROR "Python interpreter found, but is not suitable")
endif() endif()
set(LYX_PYTHON_EXECUTABLE ${Python2_EXECUTABLE} CACHE FILEPATH "Python to be used by LyX")
else()
set(LYX_PYTHON_EXECUTABLE ${Python3_EXECUTABLE} CACHE FILEPATH "Python to be used by LyX") set(LYX_PYTHON_EXECUTABLE ${Python3_EXECUTABLE} CACHE FILEPATH "Python to be used by LyX")
endif() endif()
endif()
if(LYX_NLS) if(LYX_NLS)
find_package(LyXGettext) find_package(LyXGettext)

View File

@ -51,8 +51,8 @@ if(_configure_needed)
# Get binary directory of tex2lyx # Get binary directory of tex2lyx
string(REGEX REPLACE "(.*)tex2lyx${_suffix}.*" "\\1" _bindir "${TEX2LYX_EXE}") string(REGEX REPLACE "(.*)tex2lyx${_suffix}.*" "\\1" _bindir "${TEX2LYX_EXE}")
message(STATUS "executing ${LYX_PYTHON_EXECUTABLE} -tt \"${SCRIPT_DIR}/../configure.py\" ${_with_ver} \"--binary-dir=${_bindir}\"") message(STATUS "executing ${LYX_PYTHON_EXECUTABLE} \"${SCRIPT_DIR}/../configure.py\" ${_with_ver} \"--binary-dir=${_bindir}\"")
execute_process(COMMAND ${LYX_PYTHON_EXECUTABLE} -tt "${SCRIPT_DIR}/../configure.py" execute_process(COMMAND ${LYX_PYTHON_EXECUTABLE} "${SCRIPT_DIR}/../configure.py"
${_with_ver} "--binary-dir=${_bindir}" ${_with_ver} "--binary-dir=${_bindir}"
WORKING_DIRECTORY "${LYX_TESTS_USERDIR}" WORKING_DIRECTORY "${LYX_TESTS_USERDIR}"
) )
@ -70,5 +70,3 @@ string(COMPARE NOTEQUAL ${_err} 0 _erg)
if(_erg) if(_erg)
message(FATAL_ERROR "${PY_SCRIPT} failed") message(FATAL_ERROR "${PY_SCRIPT} failed")
endif() endif()