Remove doc from API.txt

Doc parts are not removed from the API completely. This leads to
unnecessary updates to API.txt when the option/argument documentation
is changed.

This patch replaces unreliable doc stripping function with a regular
expression. It works for all current doc strings (simple string or
GetText). The only limitation is that the RE supports only up to
2 levels of nested parentheses in doc string.

https://fedorahosted.org/freeipa/ticket/1057
This commit is contained in:
Martin Kosek 2011-03-24 09:56:47 +01:00
parent 316efbc32f
commit 9915b93737
2 changed files with 318 additions and 319 deletions

626
API.txt

File diff suppressed because it is too large Load Diff

11
makeapi
View File

@ -45,14 +45,13 @@ def parse_options():
def strip_doc(line):
"""
Remove the doc= line from the repr() of a Paramter.
Remove the doc= part from the repr() of a Parameter.
"""
s = line.find(' doc=')
if s >= 0:
e = line.find('), ', s)
line = '%s%s' % (line[0:s], line[e+2:])
return line
# this pattern allows up to 2 nested parentheses in doc part
newline = re.sub(r', doc=([^(,]+)(\([^()]*(\([^()]+\)[^()]*)?\))?', '', line)
return newline
def make_api():
"""