common: port more functions and fix one
[gtk-doc.git] / gtkdoc-rebase.in
blobacd307930c92f7d2ca23f4d5542afc9294830436
1 #!@PYTHON@
2 # -*- python -*-
4 # gtk-doc - GTK DocBook documentation generator.
5 # Copyright (C) 1998  Damon Chaplin
6 #               2007  David Necas (Yeti)
7 #               2007-2016  Stefan Sauer
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24 import argparse
25 import sys
26 sys.path.append('@PYTHON_PACKAGE_DIR@')
28 from gtkdoc import config, rebase
31 if __name__ == '__main__':
32     parser = argparse.ArgumentParser(
33         description='gtkdoc-rebase version %s - rewrite links in html docs' % config.version)
34     parser.add_argument('--version', action='version', version=config.version)
35     parser.add_argument('--html-dir', dest='html_dir', default='',
36                         help='The directory which contains the installed HTML')
37     parser.add_argument('--other-dir', dest='other_dir', default=[], action='append',
38                         help='Directories to recursively scan for indices (*.devhelp2).'
39                         'May be used more than once for multiple directories.')
40     parser.add_argument('--dest-dir', dest='dest_dir', default='',
41                         help='Staging area virtual root, this prefix will be removed'
42                         'from HTML_DIR for relative link calculation.')
43     parser.add_argument('--aggressive', action='store_true', default=False,
44                         help='Rebase links to all files that are under a directory matching a package name.')
45     parser.add_argument('--verbose', action='store_true', default=False,
46                         help='Print extra output while processing')
47     parser.add_argument('--online', action='store_true', default=False,
48                         help='Prefer cross-references to online documents')
49     parser.add_argument('--relative', action='store_true', default=False,
50                         help='Prefer relative cross-references')
52     options = parser.parse_args()
54     if options.html_dir == '':
55         sys.exit("No HTML directory (--html-dir) given.")
57     sys.exit(rebase.run(options))