Fix check-params-in-docs.py for --help=param.

Message ID 975318e3-a840-7614-4393-d7851fa4e0f8@suse.cz
State New
Headers show
Series
  • Fix check-params-in-docs.py for --help=param.
Related show

Commit Message

Martin Liška May 28, 2020, 8:37 a.m.
Updated to current help format and pushed to master.

Martin

contrib/ChangeLog:

	* check-params-in-docs.py: Update to new format
	of help.  Apply flake8 corrections.
---
  contrib/check-params-in-docs.py | 17 ++++++++++-------
  1 file changed, 10 insertions(+), 7 deletions(-)

-- 
2.26.2

Patch

diff --git a/contrib/check-params-in-docs.py b/contrib/check-params-in-docs.py
index 6cff090dc4c..dfbfa3d0067 100755
--- a/contrib/check-params-in-docs.py
+++ b/contrib/check-params-in-docs.py
@@ -22,16 +22,19 @@ 
  #
  #
  
-import sys
-import json
  import argparse
+from itertools import dropwhile, takewhile
  
-from itertools import *
  
  def get_param_tuple(line):
-    line = line.strip()
+    line = line.strip().replace('--param=', '')
      i = line.find(' ')
-    return (line[:i], line[i:].strip())
+    name = line[:i]
+    if '=' in name:
+        name = name[:name.find('=')]
+    description = line[i:].strip()
+    return (name, description)
+
  
  parser = argparse.ArgumentParser()
  parser.add_argument('texi_file')
@@ -49,8 +52,8 @@  for line in open(args.params_output).readlines():
  
  # Find section in .texi manual with parameters
  texi = ([x.strip() for x in open(args.texi_file).readlines()])
-texi = dropwhile(lambda x: not 'item --param' in x, texi)
-texi = takewhile(lambda x: not '@node Instrumentation Options' in x, texi)
+texi = dropwhile(lambda x: 'item --param' not in x, texi)
+texi = takewhile(lambda x: '@node Instrumentation Options' not in x, texi)
  texi = list(texi)[1:]
  
  token = '@item '