]>
Commit | Line | Data |
---|---|---|
4e735ed6 KO |
1 | import doxymlparser |
2 | import optparse | |
3 | import sys | |
4 | import os | |
5 | import string | |
0cbc1d02 KO |
6 | import sip_tools |
7 | import swig_tools | |
4e735ed6 KO |
8 | import types |
9 | ||
0cbc1d02 KO |
10 | from common import * |
11 | ||
4e735ed6 KO |
12 | option_dict = { |
13 | "output_dir" : ("output", "Directory to output bindings to"), | |
14 | "sip" : (True, "Produce SIP bindings"), | |
15 | "swig" : (True, "Produce SWIG bindings."), | |
16 | ||
17 | } | |
18 | ||
4e735ed6 KO |
19 | parser = optparse.OptionParser(usage="usage: %prog <doxyml files to parse>\n" , version="%prog 1.0") |
20 | ||
21 | for opt in option_dict: | |
22 | default = option_dict[opt][0] | |
23 | ||
24 | action = "store" | |
25 | if type(default) == types.BooleanType: | |
26 | action = "store_true" | |
27 | parser.add_option("--" + opt, default=default, action=action, dest=opt, help=option_dict[opt][1]) | |
28 | ||
29 | options, arguments = parser.parse_args() | |
30 | ||
4e735ed6 KO |
31 | if __name__ == "__main__": |
32 | if len(arguments) < 1: | |
33 | parser.print_usage() | |
34 | sys.exit(1) | |
35 | ||
36 | doxyparse = doxymlparser.DoxyMLParser() | |
37 | for arg in arguments: | |
38 | doxyparse.parse(arg) | |
39 | ||
40 | if options.sip: | |
0cbc1d02 | 41 | builder = sip_tools.SIPBuilder(doxyparse, options.output_dir) |
4e735ed6 KO |
42 | builder.make_bindings() |
43 | ||
44 | if options.swig: | |
0cbc1d02 | 45 | builder = swig_tools.SWIGBuilder(doxyparse, options.output_dir) |
4e735ed6 | 46 | builder.make_bindings() |