cell readme generator extension changed from Directive to event
Signed-off-by: Wojciech Gryncewicz <wgryncewicz@antmicro.com>
diff --git a/docs/conf.py b/docs/conf.py
index e0e8107..fc7eef3 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -419,3 +419,6 @@
app.add_role('lib', lib_role)
app.add_role('cell', cell_role)
app.add_role('model', cell_role)
+
+ app.emit("cells_generate_readme", 'contents/libraries/*/cells/*')
+
diff --git a/docs/contents/cell-index.rst b/docs/contents/cell-index.rst
index 32b025b..448c981 100644
--- a/docs/contents/cell-index.rst
+++ b/docs/contents/cell-index.rst
@@ -1,3 +1 @@
-.. generate_cell_readme:: libraries/*/cells/*
-
.. cross_index:: libraries/*
diff --git a/scripts/python-skywater-pdk/skywater_pdk/cells/generate/readme.py b/scripts/python-skywater-pdk/skywater_pdk/cells/generate/readme.py
index 00cdf8c..ff90d34 100755
--- a/scripts/python-skywater-pdk/skywater_pdk/cells/generate/readme.py
+++ b/scripts/python-skywater-pdk/skywater_pdk/cells/generate/readme.py
@@ -155,20 +155,10 @@
# --- Sphinx extension wrapper ----------------
-class GenerateCellReadme(Directive):
+def GenerateCellReadme (app, cellpath):
- required_arguments = 1
- has_content = False
-
- def run(self):
- env = self.state.document.settings.env
- dirname = env.docname.rpartition('/')[0]
- arg = self.arguments[0]
- arg = dirname + '/' + arg
-
- print (f'GenerateCellReadme: generating files...')
-
- path = pathlib.Path(arg).expanduser()
+ print (f'GenerateCellReadme: generating files for {cellpath}')
+ path = pathlib.Path(cellpath).expanduser()
parts = path.parts[1:] if path.is_absolute() else path.parts
paths = pathlib.Path(path.root).glob(str(pathlib.Path("").joinpath(*parts)))
paths = list(paths)
@@ -184,15 +174,14 @@
errors +=1
print (f'GenerateCellReadme: {len(cell_dirs)} files processed, {errors} errors.')
- paragraph_node = nodes.paragraph()
- return [paragraph_node]
-
def setup(app):
- app.add_directive("generate_cell_readme", GenerateCellReadme)
+ app.add_event("cells_generate_readme")
+ app.connect('cells_generate_readme', GenerateCellReadme)
return {
'version': '0.1',
'parallel_read_safe': True,
+ 'parallel_write_safe': True,
}
# ----------------------------------------------