Skip to content
Snippets Groups Projects
Commit 6a002edb authored by Mattia Mancini's avatar Mattia Mancini
Browse files

OSB-44: requesting version gt 4.0 for python module celery

parent 7df1dd1b
No related branches found
No related tags found
2 merge requests!89Monitoring maintenance Epic branch merge,!1Resolve OSB-13 "Monitoringmaintenance "
......@@ -61,7 +61,7 @@ macro(find_python_module _module)
cmake_parse_arguments(PYTHON_${_MODULE}_FIND
"REQUIRED"
"HINTS"
"HINTS;VERSION"
""
${ARGN}
)
......@@ -75,6 +75,7 @@ macro(find_python_module _module)
# Try to import the python module we need to find, and get its file path.
if(PYTHON_EXECUTABLE)
set(ENV{PYTHONPATH} ${PYTHON_${_MODULE}_FIND_HINTS}:$ENV{PYTHONPATH})
set(_cmd "from __future__ import print_function; import ${_module}; print(${_module}.__file__)")
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" "-c" "${_cmd}"
......@@ -83,6 +84,19 @@ macro(find_python_module _module)
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(_cmd "from __future__ import print_function; import ${_module}; print(${_module}.__version__)")
if(${PYTHON_${_MODULE}_FIND_VERSION}) # Check the version of the module
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" "-c" "${_cmd}"
RESULT_VARIABLE _result_version
OUTPUT_VARIABLE _output_version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE)
message(STATUS "requested version ${PYTHON_${_module}_FIND_VERSION}")
if(${_output_version} VERSION_LESS ${PYTHON_${_MODULE}_FIND_VERSION} )
message(FATAL_ERROR "The installed version of PYTHON_${_MODULE} is <= ${PYTHON_${_MODULE}_FIND_VERSION}" )
endif()
endif()
# Set PYTHON_<MODULE> variable in the cache, if <module> was found.
if(_result EQUAL 0)
set(PYTHON_${_MODULE} ${_output} CACHE FILEPATH
......
......@@ -12,7 +12,7 @@ find_python_module(django REQUIRED)
find_python_module(psycopg2 REQUIRED)
find_python_module(rest_framework REQUIRED) #sudo pip install djangorestframework
find_python_module(requests REQUIRED)
find_python_module(celery REQUIRED)
find_python_module(celery REQUIRED VERSION 4)
find_python_module(django_filters REQUIRED)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment