Patch out FindPythonInterp to hopefully fix Ubuntu build
This is a bit of a hacky solution but in theory should work ok. There was discussion of bringing in FindPython3 from upstream CMake, which we could also do if someone is motivated... Fixes https://gitlab.com/kicad/code/kicad/-/issues/8553
This commit is contained in:
parent
6cfc2755ed
commit
b345d97954
|
@ -39,30 +39,33 @@ set(_PYTHON1_VERSIONS 1.6 1.5)
|
||||||
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
|
set(_PYTHON2_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
|
||||||
set(_PYTHON3_VERSIONS 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
set(_PYTHON3_VERSIONS 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
|
||||||
|
|
||||||
if(PythonInterp_FIND_VERSION)
|
# Disabling the "search every possible place" code for now
|
||||||
if(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
|
# see https://gitlab.com/kicad/code/kicad/-/issues/8553
|
||||||
string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION}")
|
|
||||||
string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
|
|
||||||
list(APPEND _Python_NAMES python${_PYTHON_FIND_MAJ_MIN} python${_PYTHON_FIND_MAJ})
|
|
||||||
unset(_PYTHON_FIND_OTHER_VERSIONS)
|
|
||||||
if(NOT PythonInterp_FIND_VERSION_EXACT)
|
|
||||||
foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
|
|
||||||
if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
|
|
||||||
list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
|
|
||||||
endif()
|
|
||||||
endforeach()
|
|
||||||
endif()
|
|
||||||
unset(_PYTHON_FIND_MAJ_MIN)
|
|
||||||
unset(_PYTHON_FIND_MAJ)
|
|
||||||
else()
|
|
||||||
list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION})
|
|
||||||
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION}_VERSIONS})
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
list(APPEND _Python_NAMES python)
|
#if(PythonInterp_FIND_VERSION)
|
||||||
|
# if(PythonInterp_FIND_VERSION MATCHES "^[0-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
|
||||||
|
# string(REGEX REPLACE "^([0-9]+\\.[0-9]+).*" "\\1" _PYTHON_FIND_MAJ_MIN "${PythonInterp_FIND_VERSION}")
|
||||||
|
# string(REGEX REPLACE "^([0-9]+).*" "\\1" _PYTHON_FIND_MAJ "${_PYTHON_FIND_MAJ_MIN}")
|
||||||
|
# list(APPEND _Python_NAMES python${_PYTHON_FIND_MAJ_MIN} python${_PYTHON_FIND_MAJ})
|
||||||
|
# unset(_PYTHON_FIND_OTHER_VERSIONS)
|
||||||
|
# if(NOT PythonInterp_FIND_VERSION_EXACT)
|
||||||
|
# foreach(_PYTHON_V ${_PYTHON${_PYTHON_FIND_MAJ}_VERSIONS})
|
||||||
|
# if(NOT _PYTHON_V VERSION_LESS _PYTHON_FIND_MAJ_MIN)
|
||||||
|
# list(APPEND _PYTHON_FIND_OTHER_VERSIONS ${_PYTHON_V})
|
||||||
|
# endif()
|
||||||
|
# endforeach()
|
||||||
|
# endif()
|
||||||
|
# unset(_PYTHON_FIND_MAJ_MIN)
|
||||||
|
# unset(_PYTHON_FIND_MAJ)
|
||||||
|
# else()
|
||||||
|
# list(APPEND _Python_NAMES python${PythonInterp_FIND_VERSION})
|
||||||
|
# set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON${PythonInterp_FIND_VERSION}_VERSIONS})
|
||||||
|
# endif()
|
||||||
|
#else()
|
||||||
|
# set(_PYTHON_FIND_OTHER_VERSIONS ${_PYTHON3_VERSIONS} ${_PYTHON2_VERSIONS} ${_PYTHON1_VERSIONS})
|
||||||
|
#endif()
|
||||||
|
|
||||||
|
list(APPEND _Python_NAMES python3 python)
|
||||||
|
|
||||||
# Search for the preferred executable first
|
# Search for the preferred executable first
|
||||||
if( ${PYTHON_ROOT_DIR} )
|
if( ${PYTHON_ROOT_DIR} )
|
||||||
|
|
Loading…
Reference in New Issue