[pygobject] Doc Extractor: Add a --no-since option.
- From: José Alburquerque <jaalburqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Doc Extractor: Add a --no-since option.
- Date: Mon, 9 May 2011 21:33:10 +0000 (UTC)
commit 303d8e8ab9e60cb554de7fc0e8592cd9b2c50843
Author: José Alburquerque <jaalburqu svn gnome org>
Date: Mon May 9 17:32:09 2011 -0400
Doc Extractor: Add a --no-since option.
* codegen/docextract.py:
* codegen/docextract_to_xml.py: Modified so that if a --no-since
option is specified at the command line, the "Since: ..." portion of
the gtkdoc function block is omitted. This is useful for C++ modules
such as gstreamermm where this information would not be useful as long
as the C API is still unstable.
codegen/docextract.py | 15 ++++++++++++++-
codegen/docextract_to_xml.py | 9 ++++++---
2 files changed, 20 insertions(+), 4 deletions(-)
---
diff --git a/codegen/docextract.py b/codegen/docextract.py
index eff8c5e..4ab5f5f 100644
--- a/codegen/docextract.py
+++ b/codegen/docextract.py
@@ -4,6 +4,14 @@ sources, so I can use them for other purposes.'''
import sys, os, string, re
+# Used to tell if the "Since: ..." portion of the gtkdoc function description
+# should be omitted. This is useful for some C++ modules such as gstreamermm
+# that wrap C API which is still unstable and including this information would
+# not be useful.
+# This variable is modified from docextract_to_xml based on the --no-since
+# option being specified.
+no_since = False
+
__all__ = ['extract']
class GtkDoc:
@@ -343,7 +351,12 @@ def process_final_sections(fp, line, cur_doc):
else:
# For all others ('Since:' and 'Deprecated:') just append
# the line to the description for now.
- cur_doc.append_to_description(line)
+ # But if the --no-since option is specified, skip the line.
+ if no_since and pattern == since_pattern:
+ line = fp.readline()
+ else:
+ cur_doc.append_to_description(line)
+
# In case more lines need to be appended.
append_func = cur_doc.append_to_description
diff --git a/codegen/docextract_to_xml.py b/codegen/docextract_to_xml.py
index f41c839..94b54b1 100755
--- a/codegen/docextract_to_xml.py
+++ b/codegen/docextract_to_xml.py
@@ -17,7 +17,7 @@ def usage():
sys.stderr.write('usage: docextract_to_xml.py ' +
'[-s /src/dir | --source-dir=/src/dir] ' +
'[-a | --with-annotations] [-p | --with-properties] ' +
- '[-i | --with-signals ]\n')
+ '[-i | --with-signals ] [-n | --no-since]\n')
sys.exit(1)
# Translates special texts to &... HTML acceptable format. Also replace
@@ -58,9 +58,10 @@ def print_annotations(annotations):
if __name__ == '__main__':
try:
- opts, args = getopt.getopt(sys.argv[1:], "d:s:o:api",
+ opts, args = getopt.getopt(sys.argv[1:], "d:s:o:apin",
["source-dir=", "with-annotations",
- "with-properties", "with-signals"])
+ "with-properties", "with-signals",
+ "no-since"])
except getopt.error, e:
sys.stderr.write('docextract_to_xml.py: %s\n' % e)
usage()
@@ -77,6 +78,8 @@ if __name__ == '__main__':
with_properties = True
if opt in ('-i', '--with-signals'):
with_signals = True
+ if opt in ('-n', '--no-since'):
+ docextract.no_since = True
if len(args) != 0:
usage()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]