[Lldb-commits] [lldb] 6336317 - [Docs] Disable Python docs when LLDB_DISABLE_PYTHON is set

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 28 09:54:52 PDT 2019


Author: Jonas Devlieghere
Date: 2019-10-28T09:53:58-07:00
New Revision: 6336317e0a37c246b7aea29a178c0d6fd3d12454

URL: https://github.com/llvm/llvm-project/commit/6336317e0a37c246b7aea29a178c0d6fd3d12454
DIFF: https://github.com/llvm/llvm-project/commit/6336317e0a37c246b7aea29a178c0d6fd3d12454.diff

LOG: [Docs] Disable Python docs when LLDB_DISABLE_PYTHON is set

This leads to a configuration error because we're trying to get a
property that doesn't exist:

get_target_property() called with non-existent target "swig_wrapper"

Added: 
    

Modified: 
    lldb/docs/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/lldb/docs/CMakeLists.txt b/lldb/docs/CMakeLists.txt
index bfdd50badf65..03d1fe99b85c 100644
--- a/lldb/docs/CMakeLists.txt
+++ b/lldb/docs/CMakeLists.txt
@@ -15,43 +15,45 @@ if(DOXYGEN_FOUND)
   )
 endif()
 
-find_program(EPYDOC_EXECUTABLE NAMES epydoc epydoc.py)
-if(EPYDOC_EXECUTABLE)
-  message(STATUS "Found epydoc - ${EPYDOC_EXECUTABLE}")
+if (NOT LLDB_DISABLE_PYTHON)
+  find_program(EPYDOC_EXECUTABLE NAMES epydoc epydoc.py)
+  if(EPYDOC_EXECUTABLE)
+    message(STATUS "Found epydoc - ${EPYDOC_EXECUTABLE}")
 
-  find_program(DOT_EXECUTABLE dot)
-  if(DOT_EXECUTABLE)
-    set(EPYDOC_OPTIONS ${EPYDOC_OPTIONS} --graph all --dotpath ${DOT_EXECUTABLE})
-    message(STATUS "Found dot - ${DOT_EXECUTABLE}")
-  endif()
+    find_program(DOT_EXECUTABLE dot)
+    if(DOT_EXECUTABLE)
+      set(EPYDOC_OPTIONS ${EPYDOC_OPTIONS} --graph all --dotpath ${DOT_EXECUTABLE})
+      message(STATUS "Found dot - ${DOT_EXECUTABLE}")
+    endif()
 
-  # Pretend to make a python package so that we can generate the reference.
-  # Because we don't build liblldb, epydoc will complain that the import of
-  # _lldb.so failed, but that doesn't prevent it from generating the docs.
-  file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lldb)
-  get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
-  add_custom_target(lldb-python-doc-package
-    COMMAND "${CMAKE_COMMAND}" -E copy "${lldb_scripts_dir}/lldb.py" "${CMAKE_CURRENT_BINARY_DIR}/lldb/__init__.py"
-    COMMENT "Copying lldb.py to pretend package.")
-  add_dependencies(lldb-python-doc-package swig_wrapper)
+    # Pretend to make a python package so that we can generate the reference.
+    # Because we don't build liblldb, epydoc will complain that the import of
+    # _lldb.so failed, but that doesn't prevent it from generating the docs.
+    file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lldb)
+    get_target_property(lldb_scripts_dir swig_wrapper BINARY_DIR)
+    add_custom_target(lldb-python-doc-package
+      COMMAND "${CMAKE_COMMAND}" -E copy "${lldb_scripts_dir}/lldb.py" "${CMAKE_CURRENT_BINARY_DIR}/lldb/__init__.py"
+      COMMENT "Copying lldb.py to pretend package.")
+    add_dependencies(lldb-python-doc-package swig_wrapper)
 
-  set(DOC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/doc")
-  file(MAKE_DIRECTORY "${DOC_DIR}")
-  add_custom_target(lldb-python-doc
-    ${EPYDOC_EXECUTABLE}
-    --html
-    lldb
-    -o ${CMAKE_CURRENT_BINARY_DIR}/python_reference
-    --name "LLDB python API"
-    --url "http://lldb.llvm.org"
-    ${EPYDOC_OPTIONS}
-    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
-    COMMENT "Generating LLDB Python API reference with epydoc" VERBATIM
-  )
-  add_dependencies(lldb-python-doc swig_wrapper lldb-python-doc-package)
-else()
-  message(STATUS "Could NOT find epydoc")
-endif()
+    set(DOC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/doc")
+    file(MAKE_DIRECTORY "${DOC_DIR}")
+    add_custom_target(lldb-python-doc
+      ${EPYDOC_EXECUTABLE}
+      --html
+      lldb
+      -o ${CMAKE_CURRENT_BINARY_DIR}/python_reference
+      --name "LLDB python API"
+      --url "http://lldb.llvm.org"
+      ${EPYDOC_OPTIONS}
+      WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+      COMMENT "Generating LLDB Python API reference with epydoc" VERBATIM
+    )
+    add_dependencies(lldb-python-doc swig_wrapper lldb-python-doc-package)
+  else()
+    message(STATUS "Could NOT find epydoc")
+  endif()
+endif ()
 
 if (LLVM_ENABLE_SPHINX)
   include(AddSphinxTarget)


        


More information about the lldb-commits mailing list