mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2024-12-13 11:40:33 +00:00
Improve Python detection
This commit is contained in:
parent
a46f9f77fe
commit
f965f4921d
@ -153,7 +153,7 @@ else()
|
||||
find_program(PYTHON_EXECUTABLE NAMES python3 python)
|
||||
if(PYTHON_EXECUTABLE)
|
||||
set(PYTHONINTERP_FOUND TRUE)
|
||||
execute_process(COMMAND "${PYTHON_EXECUTABLE} --version" OUTPUT_VARIABLE PYTHON_VERSION_STRING_AUX)
|
||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} --version OUTPUT_VARIABLE PYTHON_VERSION_STRING_AUX)
|
||||
string(FIND "${PYTHON_VERSION_STRING_AUX}" " " blank_char_index)
|
||||
if(blank_char_index GREATER -1)
|
||||
math(EXPR start_index "${blank_char_index} + 1")
|
||||
@ -161,6 +161,15 @@ else()
|
||||
string(STRIP ${PYTHON_VERSION_STRING} PYTHON_VERSION_STRING)
|
||||
string(SUBSTRING "${PYTHON_VERSION_STRING_AUX}" ${start_index} 1 PYTHON_VERSION_MAJOR)
|
||||
message(STATUS "Found Python: ${PYTHON_EXECUTABLE} (found version: ${PYTHON_VERSION_STRING})")
|
||||
else()
|
||||
string(FIND ${PYTHON_EXECUTABLE} "python3" is_python3)
|
||||
if(is_python3 GREATER -1)
|
||||
set(PYTHON_VERSION_MAJOR "3")
|
||||
set(PYTHON_VERSION_STRING "3.10") # ?
|
||||
else()
|
||||
set(PYTHON_VERSION_MAJOR "2")
|
||||
set(PYTHON_VERSION_STRING "2.7")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
gnsssdr_python_check_module("mako >= 0.4.2" mako "mako.__version__ >= '0.4.2'" MAKO_FOUND)
|
||||
|
@ -158,6 +158,15 @@ else()
|
||||
string(STRIP ${PYTHON_VERSION_STRING} PYTHON_VERSION_STRING)
|
||||
string(SUBSTRING "${PYTHON_VERSION_STRING_AUX}" ${start_index} 1 PYTHON_VERSION_MAJOR)
|
||||
message(STATUS "Found Python: ${PYTHON_EXECUTABLE} (found version: ${PYTHON_VERSION_STRING})")
|
||||
else()
|
||||
string(FIND ${PYTHON_EXECUTABLE} "python3" is_python3)
|
||||
if(is_python3 GREATER -1)
|
||||
set(PYTHON_VERSION_MAJOR "3")
|
||||
set(PYTHON_VERSION_STRING "3.10") # ?
|
||||
else()
|
||||
set(PYTHON_VERSION_MAJOR "2")
|
||||
set(PYTHON_VERSION_STRING "2.7")
|
||||
endif()
|
||||
endif()
|
||||
volk_python_check_module("mako >= 0.4.2" mako "mako.__version__ >= '0.4.2'" MAKO_FOUND)
|
||||
if(MAKO_FOUND AND PYTHON_VERSION_STRING VERSION_LESS "3.0")
|
||||
|
Loading…
Reference in New Issue
Block a user