summaryrefslogtreecommitdiffstats
path: root/makeapi
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2011-03-24 09:56:47 +0100
committerMartin Kosek <mkosek@redhat.com>2011-04-08 09:27:00 +0200
commit9915b93737fe5e31a53f2fdb169427a0b4d7e002 (patch)
tree9f6614dc1e519c7548b0e510b4a51b5f90048595 /makeapi
parent316efbc32f7b586df36653aa894e686313a64764 (diff)
downloadfreeipa-9915b93737fe5e31a53f2fdb169427a0b4d7e002.tar.gz
freeipa-9915b93737fe5e31a53f2fdb169427a0b4d7e002.tar.xz
freeipa-9915b93737fe5e31a53f2fdb169427a0b4d7e002.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-xmakeapi11
1 files changed, 5 insertions, 6 deletions
diff --git a/makeapi b/makeapi
index 1d418fe69..0d3709882 100755
--- a/makeapi
+++ b/makeapi
@@ -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():
"""