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