summaryrefslogtreecommitdiff
path: root/giscanner/docmain.py
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2013-03-28 16:14:48 -0400
committerJasper St. Pierre <jstpierre@mecheye.net>2013-06-16 01:19:36 -0400
commit3ec52d6198a8afb6360bf9985cee03cdcbfdfb63 (patch)
tree0ffdf5317d9dff40e7be23e6abe57de2a6fd0bb0 /giscanner/docmain.py
parentf0b95de7d521144113ff7ef7ff5946e35c90aae1 (diff)
downloadgobject-introspection-3ec52d6198a8afb6360bf9985cee03cdcbfdfb63.tar.gz
giscanner: Add a simple automatic sections file generator
This is a very basic sections file generator, and isn't too smart. It's simply intended to be a base to build docs on, and will be used if the user doesn't provide a sections file when calling g-ir-doc-tool, for convenience purposes. https://bugzilla.gnome.org/show_bug.cgi?id=699856
Diffstat (limited to 'giscanner/docmain.py')
-rw-r--r--giscanner/docmain.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/giscanner/docmain.py b/giscanner/docmain.py
index 3287dcc6..e65b57a0 100644
--- a/giscanner/docmain.py
+++ b/giscanner/docmain.py
@@ -22,6 +22,7 @@ import os
import optparse
from .docwriter import DocWriter
+from .sectionparser import generate_sections_file, write_sections_file
from .transformer import Transformer
@@ -38,6 +39,9 @@ def doc_main(args):
parser.add_option("", "--add-include-path",
action="append", dest="include_paths", default=[],
help="include paths for other GIR files")
+ parser.add_option("", "--write-sections-file",
+ action="store_true", dest="write_sections",
+ help="Generate and write out a sections file")
options, args = parser.parse_args(args)
if not options.output:
@@ -55,7 +59,14 @@ def doc_main(args):
extra_include_dirs.extend(options.include_paths)
transformer = Transformer.parse_from_gir(args[1], extra_include_dirs)
- writer = DocWriter(transformer, options.language)
- writer.write(options.output)
+ if options.write_sections:
+ sections_file = generate_sections_file(transformer)
+
+ fp = open(options.output, 'w')
+ write_sections_file(fp, sections_file)
+ fp.close()
+ else:
+ writer = DocWriter(transformer, options.language)
+ writer.write(options.output)
return 0