Merge pull request #11300 from djrm/pr_update_doc_status
Update doc status generator.
This commit is contained in:
commit
a74cc22591
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
import re
|
import re
|
||||||
import math
|
import math
|
||||||
@ -220,6 +221,21 @@ class ClassStatus:
|
|||||||
def generate_for_class(c):
|
def generate_for_class(c):
|
||||||
status = ClassStatus()
|
status = ClassStatus()
|
||||||
status.name = c.attrib['name']
|
status.name = c.attrib['name']
|
||||||
|
|
||||||
|
# setgets do not count
|
||||||
|
methods = []
|
||||||
|
for tag in list(c):
|
||||||
|
if tag.tag in ['methods']:
|
||||||
|
for sub_tag in list(tag):
|
||||||
|
methods.append(sub_tag.find('name'))
|
||||||
|
if tag.tag in ['members']:
|
||||||
|
for sub_tag in list(tag):
|
||||||
|
try:
|
||||||
|
methods.remove(sub_tag.find('setter'))
|
||||||
|
methods.remove(sub_tag.find('getter'))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
for tag in list(c):
|
for tag in list(c):
|
||||||
|
|
||||||
if tag.tag == 'brief_description':
|
if tag.tag == 'brief_description':
|
||||||
@ -230,9 +246,9 @@ class ClassStatus:
|
|||||||
|
|
||||||
elif tag.tag in ['methods', 'signals']:
|
elif tag.tag in ['methods', 'signals']:
|
||||||
for sub_tag in list(tag):
|
for sub_tag in list(tag):
|
||||||
descr = sub_tag.find('description')
|
if sub_tag.find('name') in methods or tag.tag == 'signals':
|
||||||
status.progresses[tag.tag].increment(len(descr.text.strip()) > 0)
|
descr = sub_tag.find('description')
|
||||||
|
status.progresses[tag.tag].increment(len(descr.text.strip()) > 0)
|
||||||
elif tag.tag in ['constants', 'members']:
|
elif tag.tag in ['constants', 'members']:
|
||||||
for sub_tag in list(tag):
|
for sub_tag in list(tag):
|
||||||
status.progresses[tag.tag].increment(len(sub_tag.text.strip()) > 0)
|
status.progresses[tag.tag].increment(len(sub_tag.text.strip()) > 0)
|
||||||
@ -252,6 +268,7 @@ class ClassStatus:
|
|||||||
|
|
||||||
input_file_list = []
|
input_file_list = []
|
||||||
input_class_list = []
|
input_class_list = []
|
||||||
|
merged_file = ""
|
||||||
|
|
||||||
for arg in sys.argv[1:]:
|
for arg in sys.argv[1:]:
|
||||||
if arg.startswith('--'):
|
if arg.startswith('--'):
|
||||||
@ -259,8 +276,10 @@ for arg in sys.argv[1:]:
|
|||||||
elif arg.startswith('-'):
|
elif arg.startswith('-'):
|
||||||
for f in arg[1:]:
|
for f in arg[1:]:
|
||||||
flags[f] = not flags[f]
|
flags[f] = not flags[f]
|
||||||
elif arg.endswith('.xml'):
|
elif os.path.isdir(arg):
|
||||||
input_file_list.append(arg)
|
for f in os.listdir(arg):
|
||||||
|
if f.endswith('.xml'):
|
||||||
|
input_file_list.append(os.path.join(arg, f));
|
||||||
else:
|
else:
|
||||||
input_class_list.append(arg)
|
input_class_list.append(arg)
|
||||||
|
|
||||||
@ -287,10 +306,9 @@ if flags['u']:
|
|||||||
|
|
||||||
if len(input_file_list) < 1 or flags['h']:
|
if len(input_file_list) < 1 or flags['h']:
|
||||||
if not flags['h']:
|
if not flags['h']:
|
||||||
print(color('section', 'Invalid usage') + ': At least one classes.xml file is required')
|
print(color('section', 'Invalid usage') + ': Please specify a classes directory')
|
||||||
print(color('section', 'Usage') + ': doc_status.py [flags] <classes.xml> [class names]')
|
print(color('section', 'Usage') + ': doc_status.py [flags] <classes_dir> [class names]')
|
||||||
print('\t< and > signify required parameters, while [ and ] signify optional parameters.')
|
print('\t< and > signify required parameters, while [ and ] signify optional parameters.')
|
||||||
print('\tNote that you can give more than one classes file, in which case they will be merged on-the-fly.')
|
|
||||||
print(color('section', 'Available flags') + ':')
|
print(color('section', 'Available flags') + ':')
|
||||||
possible_synonym_list = list(long_flags)
|
possible_synonym_list = list(long_flags)
|
||||||
possible_synonym_list.sort()
|
possible_synonym_list.sort()
|
||||||
@ -327,11 +345,10 @@ for file in input_file_list:
|
|||||||
|
|
||||||
version = doc.attrib['version']
|
version = doc.attrib['version']
|
||||||
|
|
||||||
for c in list(doc):
|
if doc.attrib['name'] in class_names:
|
||||||
if c.attrib['name'] in class_names:
|
continue
|
||||||
continue
|
class_names.append(doc.attrib['name'])
|
||||||
class_names.append(c.attrib['name'])
|
classes[doc.attrib['name']] = doc
|
||||||
classes[c.attrib['name']] = c
|
|
||||||
|
|
||||||
class_names.sort()
|
class_names.sort()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user