mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
0a0b546bdc
Checking Python dependencies has significantly slown down CMake configuration phase. We were using `pip show` for each dependency, we now do everything in a single invocation `pip list`.
30 lines
827 B
CMake
30 lines
827 B
CMake
#
|
|
# This file is distributed under the MIT License. See LICENSE.md for details.
|
|
#
|
|
# Check that required python dependencies are available
|
|
|
|
file(STRINGS "requirements.txt"
|
|
REQUIREMENTS
|
|
REGEX "^[^#].+$"
|
|
)
|
|
|
|
execute_process(
|
|
COMMAND pip3 list
|
|
RESULT_VARIABLE RETURNCODE
|
|
OUTPUT_VARIABLE PYTHON_PACKAGES
|
|
ERROR_FILE "/dev/null"
|
|
)
|
|
|
|
foreach(REQUIREMENT ${REQUIREMENTS})
|
|
string(REGEX MATCH "\n${REQUIREMENT} " RESULT "\n${PYTHON_PACKAGES}")
|
|
if("${RESULT}" STREQUAL "")
|
|
message(FATAL_ERROR "Python requirement missing: ${REQUIREMENT}")
|
|
endif()
|
|
endforeach()
|
|
|
|
# Check pyparsing version
|
|
string(REGEX MATCH "\npyparsing .*2\.4\.7.*\n" RESULT "\n${PYTHON_PACKAGES}\n")
|
|
if("${RESULT}" STREQUAL "")
|
|
message(FATAL_ERROR "pyparsing version 2.4.7 required. 3.x versions are known to cause build issues")
|
|
endif()
|