mkdb: use integer division
[gtk-doc.git] / gtkdoc-mkdb.in
blobff061e65b569c3686636a985741d7d4e0a504146
1 #!@PYTHON@
2 # -*- python; coding: utf-8 -*-
4 # gtk-doc - GTK DocBook documentation generator.
5 # Copyright (C) 1998  Damon Chaplin
6 #               2007-2016  Stefan Sauer
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
23 from __future__ import print_function
25 import argparse
26 import sys
27 sys.path.append('@PYTHON_PACKAGE_DIR@')
29 from gtkdoc import common, mkdb
31 if __name__ == '__main__':
32     parser = argparse.ArgumentParser()
33     parser.add_argument('--module', default='')
34     parser.add_argument('--source-dir', action='append', dest='source_dir', default=[])
35     parser.add_argument('--source-suffixes', dest='source_suffixes', default='')
36     parser.add_argument('--ignore-files', dest='ignore_files', default='')
37     parser.add_argument('--output-dir', dest='output_dir', default='')
38     parser.add_argument('--tmpl-dir', dest='tmpl_dir', help="DEPRECATED")
39     parser.add_argument('--main-sgml-file', dest='main_sgml_file', default='')
40     parser.add_argument('--expand-content-files', dest='expand_content_files', default='')
41     group = parser.add_mutually_exclusive_group()
42     group.add_argument('--sgml-mode', action='store_true', default=False, dest='sgml_mode')
43     group.add_argument('--xml-mode', action='store_true', default=False, dest='xml_mode')
44     parser.add_argument('--default-stability', dest='default_stability',
45                         choices=['', 'Stable', 'Private', 'Unstable'], default='')
46     parser.add_argument('--default-includes', dest='default_includes', default='')
47     parser.add_argument('--output-format', default='xml')  # MUST be 'xml', deprecate?
48     parser.add_argument('--name-space', dest='name_space', default='')
49     parser.add_argument('--outputallsymbols', default=False, action='store_true')
50     parser.add_argument('--outputsymbolswithoutsince', default=False, action='store_true')
52     options = parser.parse_args()
53     if options.module == '':
54         print('Error, missing module.')
55         sys.exit(1)
57     if options.output_format != "xml":
58         sys.exit('Invalid format "%s" passed to --output.format' % options.output_format)
60     common.setup_logging()
62     mkdb.Run(options)