diff options
author | Martin Kosek <mkosek@redhat.com> | 2011-05-12 08:28:22 +0200 |
---|---|---|
committer | Martin Kosek <mkosek@redhat.com> | 2011-05-13 13:06:37 +0200 |
commit | 72b56e4630f99608808522b2b5f768497f94d2bd (patch) | |
tree | c089fcea4b856b917e834b55cd5431f574a1f94f /makeapi | |
parent | 9de10f3674078ef8c423522e30fe704a2d09a7c2 (diff) | |
download | freeipa-72b56e4630f99608808522b2b5f768497f94d2bd.tar.gz freeipa-72b56e4630f99608808522b2b5f768497f94d2bd.tar.xz freeipa-72b56e4630f99608808522b2b5f768497f94d2bd.zip |
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
Diffstat (limited to 'makeapi')
-rwxr-xr-x | makeapi | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -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(): """ |