Files
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

49 lines
1.6 KiB
Python

from docutils.parsers.rst import directives, Directive
from docutils import utils, statemachine
from sphinx.application import Sphinx
import os
from pathlib import Path
class BuildInclude(Directive):
"""
Directive to include generated files from the build directory (specified by LLDB_BUILD_DIR).
This is a simplified version of the `include` directive from docutils with the change that paths
are relative to the build directory.
"""
required_arguments = 1
optional_arguments = 0
final_argument_whitespace = True
option_spec = {"parser": directives.parser_name}
def run(self):
path = directives.path(self.arguments[0])
path = utils.relative_path(None, Path(os.environ["LLDB_BUILD_DIR"]) / path)
with open(path, encoding="utf-8") as f:
rawtext = f.read()
include_lines = statemachine.string2lines(
rawtext, self.state.document.settings.tab_width, convert_whitespace=True
)
# parse into a dummy document and return created nodes
document = utils.new_document(path, self.state.document.settings)
parser = self.options["parser"]()
parser.parse("\n".join(include_lines), document)
# clean up doctree and complete parsing
document.transformer.populate_from_components((parser,))
document.transformer.apply_transforms()
self.state.document.settings.record_dependencies.add(path)
return document.children
def setup(app: Sphinx):
app.add_directive("build-include", BuildInclude)
return {
"version": "0.1",
"parallel_read_safe": True,
"parallel_write_safe": True,
}