29 Function to print some usage information. |
29 Function to print some usage information. |
30 |
30 |
31 It prints a reference of all commandline parameters that may |
31 It prints a reference of all commandline parameters that may |
32 be used and ends the application. |
32 be used and ends the application. |
33 """ |
33 """ |
34 print "eric4-api" |
34 print("eric4-api") |
35 print |
35 print() |
36 print "Copyright (c) 2004 - 2009 Detlev Offenbach <detlev@die-offenbachs.de>." |
36 print("Copyright (c) 2004 - 2009 Detlev Offenbach <detlev@die-offenbachs.de>.") |
37 print |
37 print() |
38 print "Usage:" |
38 print("Usage:") |
39 print |
39 print() |
40 print " eric4-api [options] files..." |
40 print(" eric4-api [options] files...") |
41 print |
41 print() |
42 print "where files can be either python modules, package" |
42 print("where files can be either python modules, package") |
43 print "directories or ordinary directories." |
43 print("directories or ordinary directories.") |
44 print |
44 print() |
45 print "Options:" |
45 print("Options:") |
46 print |
46 print() |
47 print " -b name or --base name" |
47 print(" -b name or --base name") |
48 print " Use the given name as the name of the base package." |
48 print(" Use the given name as the name of the base package.") |
49 print " -h or --help" |
49 print(" -h or --help") |
50 print " Show this help and exit." |
50 print(" Show this help and exit.") |
51 print " -o filename or --output=filename" |
51 print(" -o filename or --output=filename") |
52 print " Write the API information to the named file. A '%L' placeholder" |
52 print(" Write the API information to the named file. A '%L' placeholder") |
53 print " is replaced by the language of the API file (see --language)." |
53 print(" is replaced by the language of the API file (see --language).") |
54 print " --oldstyle" |
54 print(" --oldstyle") |
55 print " Generate API files for QScintilla prior to 1.7." |
55 print(" Generate API files for QScintilla prior to 1.7.") |
56 print " -p or --private" |
56 print(" -p or --private") |
57 print " Include private methods and functions." |
57 print(" Include private methods and functions.") |
58 print " -R, -r or --recursive" |
58 print(" -R, -r or --recursive") |
59 print " Perform a recursive search for source files." |
59 print(" Perform a recursive search for source files.") |
60 print " -t ext or --extension=ext" |
60 print(" -t ext or --extension=ext") |
61 print " Add the given extension to the list of file extensions." |
61 print(" Add the given extension to the list of file extensions.") |
62 print " This option may be given multiple times." |
62 print(" This option may be given multiple times.") |
63 print " -V or --version" |
63 print(" -V or --version") |
64 print " Show version information and exit." |
64 print(" Show version information and exit.") |
65 print " -x directory or --exclude=directory" |
65 print(" -x directory or --exclude=directory") |
66 print " Specify a directory basename to be excluded." |
66 print(" Specify a directory basename to be excluded.") |
67 print " This option may be repeated multiple times." |
67 print(" This option may be repeated multiple times.") |
68 print " --exclude-file=pattern" |
68 print(" --exclude-file=pattern") |
69 print " Specify a filename pattern of files to be excluded." |
69 print(" Specify a filename pattern of files to be excluded.") |
70 print " This option may be repeated multiple times." |
70 print(" This option may be repeated multiple times.") |
71 print " -l language or --language=language" |
71 print(" -l language or --language=language") |
72 print " Generate an API file for the given programming language." |
72 print(" Generate an API file for the given programming language.") |
73 print " Supported programming languages are:" |
73 print(" Supported programming languages are:") |
74 for lang in sorted(DocumentationTools.supportedExtensionsDictForApis.keys()): |
74 for lang in sorted(DocumentationTools.supportedExtensionsDictForApis.keys()): |
75 print " * %s" % lang |
75 print(" * %s" % lang) |
76 print " The default is 'Python'." |
76 print(" The default is 'Python'.") |
77 print " This option may be repeated multiple times." |
77 print(" This option may be repeated multiple times.") |
78 sys.exit(1) |
78 sys.exit(1) |
79 |
79 |
80 def version(): |
80 def version(): |
81 """ |
81 """ |
82 Function to show the version information. |
82 Function to show the version information. |
83 """ |
83 """ |
84 print \ |
84 print("""eric4-api %s |
85 """eric4-api %s |
|
86 |
85 |
87 Eric4 API generator. |
86 Eric4 API generator. |
88 |
87 |
89 Copyright (c) 2004 - 2009 Detlev Offenbach <detlev@die-offenbachs.de> |
88 Copyright (c) 2004 - 2009 Detlev Offenbach <detlev@die-offenbachs.de> |
90 This is free software; see the LICENSE.GPL3 for copying conditions. |
89 This is free software; see the LICENSE.GPL3 for copying conditions. |
91 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A |
90 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A |
92 PARTICULAR PURPOSE.""" % Version |
91 PARTICULAR PURPOSE.""" % Version) |
93 sys.exit(1) |
92 sys.exit(1) |
94 |
93 |
95 def main(): |
94 def main(): |
96 """ |
95 """ |
97 Main entry point into the application. |
96 Main entry point into the application. |
239 try: |
238 try: |
240 module = Utilities.ModuleParser.readModule(file, |
239 module = Utilities.ModuleParser.readModule(file, |
241 basename = basename, inpackage = inpackage) |
240 basename = basename, inpackage = inpackage) |
242 apiGenerator = APIGenerator(module) |
241 apiGenerator = APIGenerator(module) |
243 api = apiGenerator.genAPI(newStyle, basePackage, includePrivate) |
242 api = apiGenerator.genAPI(newStyle, basePackage, includePrivate) |
244 except IOError, v: |
243 except IOError as v: |
245 sys.stderr.write("%s error: %s\n" % (file, v[1])) |
244 sys.stderr.write("%s error: %s\n" % (file, v[1])) |
246 continue |
245 continue |
247 except ImportError, v: |
246 except ImportError as v: |
248 sys.stderr.write("%s error: %s\n" % (file, v)) |
247 sys.stderr.write("%s error: %s\n" % (file, v)) |
249 continue |
248 continue |
250 |
249 |
251 for apiEntry in api: |
250 for apiEntry in api: |
252 if not apiEntry in apis: |
251 if not apiEntry in apis: |