summaryrefslogtreecommitdiff
path: root/scripts/xls_to_doc.py
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@kernel.org>2024-03-14 09:08:29 +0100
committerMauro Carvalho Chehab <mchehab@kernel.org>2024-03-15 10:18:03 +0100
commitf41e2a7f48b5dd59e4c24e991facdd6dbcc5d156 (patch)
treeeed281e7684634b061f56e29d80b59f77f6c6854 /scripts/xls_to_doc.py
parent25cb7be230a49c9b6484c95d71ec0ba2dfc0c8cb (diff)
scripts/xls_to_doc.py: better handle common attributes
Instead of using self.props plus an ingore_fields, create a list of values to be updated and use it everywhere, as it helps being consistent along the script about what fields should be updated. Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> Acked-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
Diffstat (limited to 'scripts/xls_to_doc.py')
-rwxr-xr-xscripts/xls_to_doc.py27
1 files changed, 20 insertions, 7 deletions
diff --git a/scripts/xls_to_doc.py b/scripts/xls_to_doc.py
index 03feae583..60f7536c8 100755
--- a/scripts/xls_to_doc.py
+++ b/scripts/xls_to_doc.py
@@ -31,9 +31,10 @@ class FillTests(TestList):
def __init__(self, config_path, verbose):
self.tests = {}
self.spreadsheet_data = {}
- self.ignore_fields = []
self.verbose = verbose
+ self.update_fields = []
+
# Read current documentation
TestList.__init__(self, config_path)
@@ -78,7 +79,9 @@ class FillTests(TestList):
if "sublevel" in item["_properties_"]:
update = item["_properties_"].get("update-from-file")
if update:
- self.ignore_fields.append(field)
+ continue
+
+ self.update_fields.append(field)
def add_field(self, dic, field, value):
"""
@@ -276,8 +279,22 @@ class FillTests(TestList):
test_nr = self.tests[testname]["Test"]
+ # Update common fields
doc_content = self.orig_doc[test_nr]
+ fields = set(self.doc[test_nr].keys()) | set(doc_content.keys())
+
+ for field in sorted(fields):
+ if field not in self.update_fields:
+ continue
+
+ value = self.doc[test_nr].get(field, "")
+ doc_value = doc_content.get(field, "")
+ if doc_value == value:
+ continue
+
+
+ # Update subtest fields
for subtest, subtest_content in sorted(self.tests[testname]["subtests"].items()):
if "line" not in subtest_content:
print(f"Warning: didn't find where {subtest} is documented.")
@@ -298,11 +315,7 @@ class FillTests(TestList):
fields = set(subtest_content.keys()) | set(doc_content.keys())
for field in sorted(fields):
- if field not in self.props:
- continue
-
- if args.ignore_lists:
- if field in self.ignore_fields:
+ if field not in self.update_fields:
continue
value = subtest_content.get(field, "")