[llvm] r321659 - [opt-viewer] Check for pygments.lexer.c_cpp

Jonas Hahnfeld via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 2 09:53:09 PST 2018


Author: hahnfeld
Date: Tue Jan  2 09:53:08 2018
New Revision: 321659

URL: http://llvm.org/viewvc/llvm-project?rev=321659&view=rev
Log:
[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

Modified:
    llvm/trunk/cmake/config-ix.cmake

Modified: llvm/trunk/cmake/config-ix.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/config-ix.cmake?rev=321659&r1=321658&r2=321659&view=diff
==============================================================================
--- llvm/trunk/cmake/config-ix.cmake (original)
+++ llvm/trunk/cmake/config-ix.cmake Tue Jan  2 09:53:08 2018
@@ -640,7 +640,8 @@ endif()
 string(REPLACE " " ";" LLVM_BINDINGS_LIST "${LLVM_BINDINGS}")
 
 function(find_python_module module)
-  string(TOUPPER ${module} module_upper)
+  string(REPLACE "." "_" module_name ${module})
+  string(TOUPPER ${module_name} module_upper)
   set(FOUND_VAR PY_${module_upper}_FOUND)
 
   execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import ${module}"
@@ -658,13 +659,16 @@ endfunction()
 
 set (PYTHON_MODULES
   pygments
+  # Some systems still don't have pygments.lexers.c_cpp which was introduced in
+  # version 2.0 in 2014...
+  pygments.lexers.c_cpp
   yaml
   )
 foreach(module ${PYTHON_MODULES})
   find_python_module(${module})
 endforeach()
 
-if(PY_PYGMENTS_FOUND AND PY_YAML_FOUND)
+if(PY_PYGMENTS_FOUND AND PY_PYGMENTS_LEXERS_C_CPP_FOUND AND PY_YAML_FOUND)
   set (LLVM_HAVE_OPT_VIEWER_MODULES 1)
 else()
   set (LLVM_HAVE_OPT_VIEWER_MODULES 0)




More information about the llvm-commits mailing list