File: gtkdoc-scangobj.in

package info (click to toggle)
gtk-doc 1.33.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 4,772 kB
  • sloc: python: 10,012; ansic: 915; xml: 889; makefile: 554; sh: 364; lisp: 137; perl: 109
file content (81 lines) | stat: -rwxr-xr-x 3,338 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!@PYTHON@
# -*- python -*-
#
# gtk-doc - GTK DocBook documentation generator.
# Copyright (C) 1998  Damon Chaplin
#               2007-2016  Stefan Sauer
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#

import argparse
import os
import sys

try:
  import gtkdoc_uninstalled
except ModuleNotFoundError:
  sys.path.append('@PYTHON_PACKAGE_DIR@')

from gtkdoc import common, config, scangobj

if __name__ == '__main__':
    parser = argparse.ArgumentParser(
        description='gtkdoc-rebase version %s - introspect g-objects' % config.version)
    parser.add_argument('--version', action='version', version=config.version)
    parser.add_argument('--module', required=True,
                        help='Name of the doc module being parsed')
    parser.add_argument('--types', default='',
                        help='The name of the file to store the types in')
    parser.add_argument('--type-init-func', default='',
                        help='The init function(s) to call instead of g_type_init()')
    parser.add_argument('--query-child-properties', default='',
                        help='A function that returns a list of child properties for a class')
    parser.add_argument('--output-dir', default='.',
                        help='The directory where the results are stored')
    parser.add_argument('--cc', default='', help='The compiler to use')
    parser.add_argument('--ld', default='', help='The linker to use')
    parser.add_argument('--cflags', type=str, default=[], help='Compiler flags',
                        action='append')
    parser.add_argument('--ldflags', type=str, default=[], help='Linker flags',
                        action='append')
    parser.add_argument('--run', default='',
                        help='Command for running the scanner')
    parser.add_argument('--verbose', action='store_true', default=False,
                        help='Print extra output while processing')

    options = parser.parse_args()

    if options.types == '':
        options.types = os.path.join(options.output_dir, options.module + '.types')
    if options.cflags:
        options.cflags = ' '.join(options.cflags)
    if options.ldflags:
        options.ldflags = ' '.join(options.ldflags)

    if not options.cc:
        options.cc = os.environ.get('CC', 'gcc')
    if not options.ld:
        options.ld = os.environ.get('LD', options.cc)
    if not options.cflags:
        options.cflags = os.environ.get('CFLAGS', '')
    if not options.ldflags:
        options.ldflags = os.environ.get('LDFLAGS', '')
    if not options.run:
        options.run = os.environ.get('RUN', '')

    common.setup_logging()

    sys.exit(scangobj.run(options))