Skip to content

Commit b24a45d

Browse files
committed
[opt-viewer] Check for pygments.lexer.c_cpp
Some systems still don't have this module which was introduced in version 2.0 (CentOS 7, sigh). Differential Revision: https://reviews.llvm.org/D41611 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@321659 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 8d24966 commit b24a45d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

cmake/config-ix.cmake

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,8 @@ endif()
640640
string(REPLACE " " ";" LLVM_BINDINGS_LIST "${LLVM_BINDINGS}")
641641

642642
function(find_python_module module)
643-
string(TOUPPER ${module} module_upper)
643+
string(REPLACE "." "_" module_name ${module})
644+
string(TOUPPER ${module_name} module_upper)
644645
set(FOUND_VAR PY_${module_upper}_FOUND)
645646

646647
execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import ${module}"
@@ -658,13 +659,16 @@ endfunction()
658659

659660
set (PYTHON_MODULES
660661
pygments
662+
# Some systems still don't have pygments.lexers.c_cpp which was introduced in
663+
# version 2.0 in 2014...
664+
pygments.lexers.c_cpp
661665
yaml
662666
)
663667
foreach(module ${PYTHON_MODULES})
664668
find_python_module(${module})
665669
endforeach()
666670

667-
if(PY_PYGMENTS_FOUND AND PY_YAML_FOUND)
671+
if(PY_PYGMENTS_FOUND AND PY_PYGMENTS_LEXERS_C_CPP_FOUND AND PY_YAML_FOUND)
668672
set (LLVM_HAVE_OPT_VIEWER_MODULES 1)
669673
else()
670674
set (LLVM_HAVE_OPT_VIEWER_MODULES 0)

0 commit comments

Comments
 (0)