forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lldb][docs] Use sphinx instead of epydoc to generate LLDB's Python r…
…eference Currently LLDB uses epydoc to generate the Python API reference for the website. epydoc however is unmaintained since more than a decade and no longer works with Python 3. Also whatever setup we had once for generating the documentation on the website server no longer seems to work, so the current website documentation has been stale since more than a year. This patch replaces epydoc with sphinx and its automodapi plugin that can generate Python API references. LLVM already uses sphinx for the rest of the documentation, so this way we are more consistent with the rest of LLVM. The only new dependency is the automodapi plugin for sphinx. This patch effectively does the following things: * Remove the epydoc code. * Make a new dummy Python API page in our website that just calls the Sphinx command for generated the API documentation. * Add a mock _lldb module that is only used when generating the Python API. This way we don't have to build all of LLDB to generate the API reference. Some notes: * The long list of skips is necessary due to boilerplate functions that SWIG is generating. Sadly automodapi is not really scriptable from what I can see, so we have to blacklist this stuff manually. * The .gitignore change because automodapi wants a subfolder of our documentation directory to place generated documentation files there. The path is also what is used on the website, so we can't really workaround this (without copying the whole `docs` dir somewhere else when we build). * We have to use environment variables to pass our build path to our sphinx configuration. Sphinx doesn't support passing variables onto that script. Reviewed By: JDevlieghere Differential Revision: https://reviews.llvm.org/D94489
- Loading branch information
Showing
7 changed files
with
156 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from unittest.mock import Mock | ||
import sys | ||
import types | ||
|
||
# This package acts as a mock implementation of the native _lldb module so | ||
# that generating the LLDB documentation doesn't actually require building all | ||
# of LLDB. | ||
module_name = '_lldb' | ||
sys.modules[module_name] = Mock() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
LLDB Python API | ||
================================ | ||
|
||
.. | ||
The long list of "skip" filters out several global functions that are | ||
generated by SWIG (but which are not useful as they are only the | ||
backend for their respective static functions in the classes). | ||
Without this list | ||
.. automodapi:: lldb | ||
:no-inheritance-diagram: | ||
:skip: SBBreakpoint_EventIsBreakpointEvent | ||
:skip: SBBreakpoint_GetBreakpointEventTypeFromEvent | ||
:skip: SBBreakpoint_GetBreakpointFromEvent | ||
:skip: SBBreakpoint_GetBreakpointLocationAtIndexFromEvent | ||
:skip: SBBreakpoint_GetNumBreakpointLocationsFromEvent | ||
:skip: SBCommandInterpreter_EventIsCommandInterpreterEvent | ||
:skip: SBCommandInterpreter_GetArgumentDescriptionAsCString | ||
:skip: SBCommandInterpreter_GetArgumentTypeAsCString | ||
:skip: SBCommandInterpreter_GetBroadcasterClass | ||
:skip: SBCommunication_GetBroadcasterClass | ||
:skip: SBData_CreateDataFromCString | ||
:skip: SBData_CreateDataFromDoubleArray | ||
:skip: SBData_CreateDataFromSInt32Array | ||
:skip: SBData_CreateDataFromSInt64Array | ||
:skip: SBData_CreateDataFromUInt32Array | ||
:skip: SBData_CreateDataFromUInt64Array | ||
:skip: SBDebugger_Create | ||
:skip: SBDebugger_Create | ||
:skip: SBDebugger_Destroy | ||
:skip: SBDebugger_FindDebuggerWithID | ||
:skip: SBDebugger_GetBuildConfiguration | ||
:skip: SBDebugger_GetDefaultArchitecture | ||
:skip: SBDebugger_GetInternalVariableValue | ||
:skip: SBDebugger_GetVersionString | ||
:skip: SBDebugger_Initialize | ||
:skip: SBDebugger_InitializeWithErrorHandling | ||
:skip: SBDebugger_MemoryPressureDetected | ||
:skip: SBDebugger_SetDefaultArchitecture | ||
:skip: SBDebugger_SetInternalVariable | ||
:skip: SBDebugger_StateAsCString | ||
:skip: SBDebugger_StateIsRunningState | ||
:skip: SBDebugger_StateIsStoppedState | ||
:skip: SBDebugger_Terminate | ||
:skip: SBEvent_GetCStringFromEvent | ||
:skip: SBFileSpec_ResolvePath | ||
:skip: SBFile_MakeBorrowed | ||
:skip: SBFile_MakeBorrowedForcingIOMethods | ||
:skip: SBFile_MakeForcingIOMethods | ||
:skip: SBHostOS_GetLLDBPath | ||
:skip: SBHostOS_GetLLDBPythonPath | ||
:skip: SBHostOS_GetProgramFileSpec | ||
:skip: SBHostOS_GetUserHomeDirectory | ||
:skip: SBHostOS_ThreadCancel | ||
:skip: SBHostOS_ThreadCreate | ||
:skip: SBHostOS_ThreadCreated | ||
:skip: SBHostOS_ThreadDetach | ||
:skip: SBHostOS_ThreadJoin | ||
:skip: SBLanguageRuntime_GetLanguageTypeFromString | ||
:skip: SBLanguageRuntime_GetNameForLanguageType | ||
:skip: SBModuleSpecList_GetModuleSpecifications | ||
:skip: SBModule_GarbageCollectAllocatedModules | ||
:skip: SBModule_GetNumberAllocatedModules | ||
:skip: SBPlatform_GetHostPlatform | ||
:skip: SBProcess_EventIsProcessEvent | ||
:skip: SBProcess_EventIsStructuredDataEvent | ||
:skip: SBProcess_GetBroadcasterClassName | ||
:skip: SBProcess_GetInterruptedFromEvent | ||
:skip: SBProcess_GetNumRestartedReasonsFromEvent | ||
:skip: SBProcess_GetProcessFromEvent | ||
:skip: SBProcess_GetRestartedFromEvent | ||
:skip: SBProcess_GetRestartedReasonAtIndexFromEvent | ||
:skip: SBProcess_GetStateFromEvent | ||
:skip: SBProcess_GetStructuredDataFromEvent | ||
:skip: SBReproducer_Capture | ||
:skip: SBReproducer_PassiveReplay | ||
:skip: SBReproducer_SetAutoGenerate | ||
:skip: SBReproducer_SetWorkingDirectory | ||
:skip: SBTarget_EventIsTargetEvent | ||
:skip: SBTarget_GetBroadcasterClassName | ||
:skip: SBTarget_GetModuleAtIndexFromEvent | ||
:skip: SBTarget_GetNumModulesFromEvent | ||
:skip: SBTarget_GetTargetFromEvent | ||
:skip: SBThread_EventIsThreadEvent | ||
:skip: SBThread_GetBroadcasterClassName | ||
:skip: SBThread_GetStackFrameFromEvent | ||
:skip: SBThread_GetThreadFromEvent | ||
:skip: SBTypeSummary_CreateWithFunctionName | ||
:skip: SBTypeSummary_CreateWithScriptCode | ||
:skip: SBTypeSummary_CreateWithSummaryString | ||
:skip: SBTypeSynthetic_CreateWithClassName | ||
:skip: SBTypeSynthetic_CreateWithScriptCode | ||
:skip: SBWatchpoint_EventIsWatchpointEvent | ||
:skip: SBWatchpoint_GetWatchpointEventTypeFromEvent | ||
:skip: SBWatchpoint_GetWatchpointFromEvent | ||
:skip: command | ||
:skip: in_range | ||
:skip: is_numeric_type | ||
:skip: lldb_iter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters