summaryrefslogtreecommitdiffstats
path: root/doc/genlist-from-docbooks.py
diff options
context:
space:
mode:
authorBenjamin Drung <bdrung@debian.org>2023-06-10 08:55:33 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2023-06-10 09:21:49 +0000
commit88837172f69eabc408ae3945d82e0270b8e07440 (patch)
treed6b7fa06694f45d25f54f6ea9ded93c981e51f6f /doc/genlist-from-docbooks.py
parentInitial commit. (diff)
downloadnvme-stas-88837172f69eabc408ae3945d82e0270b8e07440.tar.xz
nvme-stas-88837172f69eabc408ae3945d82e0270b8e07440.zip
Adding upstream version 2.2.1.upstream/2.2.1
Signed-off-by: Benjamin Drung <bdrung@debian.org>
Diffstat (limited to 'doc/genlist-from-docbooks.py')
-rwxr-xr-xdoc/genlist-from-docbooks.py36
1 files changed, 36 insertions, 0 deletions
diff --git a/doc/genlist-from-docbooks.py b/doc/genlist-from-docbooks.py
new file mode 100755
index 0000000..f094e09
--- /dev/null
+++ b/doc/genlist-from-docbooks.py
@@ -0,0 +1,36 @@
+#!/usr/bin/python3
+import glob
+from lxml import etree
+
+exclude_list = list(glob.glob('standard-*.xml'))
+
+PARSER = etree.XMLParser(remove_blank_text=True)
+
+
+def extract_data(fname):
+ et = etree.parse(fname, PARSER)
+
+ manvolnum = et.find('./refmeta/manvolnum')
+ manvolnum = manvolnum.text if manvolnum is not None else 0
+
+ deps = set()
+ for elem in et.iter():
+ keys = elem.keys()
+ if 'href' in keys and 'xpointer' in keys:
+ dep = elem.values()[0]
+ if dep in exclude_list:
+ deps.add(dep)
+
+ return manvolnum, list(deps)
+
+
+output = list()
+file_list = glob.glob('*.xml')
+for fname in file_list:
+ if fname not in exclude_list:
+ stem = fname[0:-4]
+ manvolnum, deps = extract_data(fname)
+ deps = ':'.join(deps) if deps else 'None'
+ output.append(','.join([stem, manvolnum, fname, deps]))
+
+print(';'.join(output))