mirror of https://github.com/YosysHQ/yosys.git
Docs: Add cells loc config value
This commit is contained in:
parent
1b0d8633c4
commit
ccd3bace23
|
@ -1,4 +1,5 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
from pathlib import Path
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@ -79,6 +80,7 @@ extensions.append('util.cmdref')
|
||||||
# use autodocs
|
# use autodocs
|
||||||
extensions.append('sphinx.ext.autodoc')
|
extensions.append('sphinx.ext.autodoc')
|
||||||
extensions.append('util.cellref')
|
extensions.append('util.cellref')
|
||||||
|
cells_loc = Path(__file__).parent / 'generated'
|
||||||
|
|
||||||
from sphinx.application import Sphinx
|
from sphinx.application import Sphinx
|
||||||
def setup(app: Sphinx) -> None:
|
def setup(app: Sphinx) -> None:
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path, PosixPath, WindowsPath
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
@ -140,7 +140,8 @@ class YosysCellDocumenter(Documenter):
|
||||||
# find cell lib file
|
# find cell lib file
|
||||||
objpath = Path('/'.join(self.objpath))
|
objpath = Path('/'.join(self.objpath))
|
||||||
if not objpath.exists():
|
if not objpath.exists():
|
||||||
objpath = Path('source') / 'generated' / objpath
|
cells_loc: Path = self.config.cells_loc
|
||||||
|
objpath = cells_loc / objpath
|
||||||
|
|
||||||
# load cell lib
|
# load cell lib
|
||||||
try:
|
try:
|
||||||
|
@ -358,6 +359,7 @@ class YosysCellSourceDocumenter(YosysCellDocumenter):
|
||||||
return False, []
|
return False, []
|
||||||
|
|
||||||
def setup(app: Sphinx) -> dict[str, Any]:
|
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.setup_extension('sphinx.ext.autodoc')
|
||||||
app.add_autodocumenter(YosysCellDocumenter)
|
app.add_autodocumenter(YosysCellDocumenter)
|
||||||
app.add_autodocumenter(YosysCellSourceDocumenter)
|
app.add_autodocumenter(YosysCellSourceDocumenter)
|
||||||
|
|
Loading…
Reference in New Issue