Skip to content

Commit

Permalink
Docs: Add cells loc config value
Browse files Browse the repository at this point in the history
  • Loading branch information
KrystalDelusion committed May 20, 2024
1 parent e9b5878 commit 2f53e7b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env python3
from pathlib import Path
import sys
import os

Expand Down Expand Up @@ -49,6 +50,7 @@
# use autodocs
extensions.append('sphinx.ext.autodoc')
extensions.append('util.cellref')
cells_loc = Path(__file__).parent / 'generated'

from sphinx.application import Sphinx
def setup(app: Sphinx) -> None:
Expand Down
6 changes: 4 additions & 2 deletions docs/util/cellref.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
from __future__ import annotations

from pathlib import Path
from pathlib import Path, PosixPath, WindowsPath
import re

from typing import Any
Expand Down Expand Up @@ -140,7 +140,8 @@ def import_object(self, raiseerror: bool = False) -> bool:
# find cell lib file
objpath = Path('/'.join(self.objpath))
if not objpath.exists():
objpath = Path('source') / 'generated' / objpath
cells_loc: Path = self.config.cells_loc
objpath = cells_loc / objpath

# load cell lib
try:
Expand Down Expand Up @@ -358,6 +359,7 @@ def get_object_members(
return False, []

def setup(app: Sphinx) -> dict[str, Any]:
app.add_config_value('cells_loc', False, 'html', [Path, PosixPath, WindowsPath])
app.setup_extension('sphinx.ext.autodoc')
app.add_autodocumenter(YosysCellDocumenter)
app.add_autodocumenter(YosysCellSourceDocumenter)
Expand Down

0 comments on commit 2f53e7b

Please sign in to comment.