From c74b4d8ceb5b094b2f4601d3a9cea459cebfc105 Mon Sep 17 00:00:00 2001 From: Wojciech Gryncewicz Date: Thu, 19 Nov 2020 17:19:44 +0100 Subject: [PATCH] Cell_list now appends links to cell readmes --- .../skywater_pdk/cell_list.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/python-skywater-pdk/skywater_pdk/cell_list.py b/scripts/python-skywater-pdk/skywater_pdk/cell_list.py index 2c32db8..64ba871 100755 --- a/scripts/python-skywater-pdk/skywater_pdk/cell_list.py +++ b/scripts/python-skywater-pdk/skywater_pdk/cell_list.py @@ -148,10 +148,25 @@ def AppendToReadme (celllistfile): with open(str(readmefile), "r") as f: for i, l in enumerate(f): if i<5: old += l - + + # get cell readme list + lscmd = 'ls -1a ' + str(celllistfile.parents[0])+"/cells/*/README.rst 2>/dev/null" + cellrdm = os.popen(lscmd).read().strip().split('\n') + cellrdm = [c.replace(str(celllistfile.parents[0])+'/','') for c in cellrdm] + with open(str(readmefile), "w+") as f: f.write(old) tableinc = f'.. include:: {celllistfile.name}\n' + + if len(cellrdm): + f.write('\n\n\n') + f.write('Cell descriptions\n') + f.write('-----------------\n\n') + f.write('.. toctree::\n\n') + for c in cellrdm: + f.write(f' {c}\n') + f.write('\n\n\n') + if not tableinc in old: f.write(tableinc)