eric5_api.py

Sun, 29 Sep 2013 18:22:08 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 29 Sep 2013 18:22:08 +0200
changeset 2965
d133c7edd88a
parent 2302
f29e9405c851
child 2992
dbdf27746da5
permissions
-rw-r--r--

Continued correcting doc strings by using the new doc string checker.

15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 #!/usr/bin/env python3
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2 # -*- coding: utf-8 -*-
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3
2302
f29e9405c851 Updated copyright for 2013.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2008
diff changeset
4 # Copyright (c) 2003 - 2013 Detlev Offenbach <detlev@die-offenbachs.de>
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5 #
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 """
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
8 Eric5 API Generator.
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 This is the main Python script of the API generator. It is
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 this script that gets called via the API generation interface.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 This script can be used via the commandline as well.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 import glob
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 import os
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 import sys
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 import fnmatch
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 import Utilities.ModuleParser
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 from DocumentationTools.APIGenerator import APIGenerator
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 from UI.Info import Version
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 import Utilities
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 import DocumentationTools
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
26
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 def usage():
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 Function to print some usage information.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 It prints a reference of all commandline parameters that may
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 be used and ends the application.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
908
d00447340771 Did the last changes to the Windows related install stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
34 print("eric5_api")
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 print()
2302
f29e9405c851 Updated copyright for 2013.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2008
diff changeset
36 print("Copyright (c) 2004 - 2013 Detlev Offenbach <detlev@die-offenbachs.de>.")
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 print()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 print("Usage:")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 print()
908
d00447340771 Did the last changes to the Windows related install stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
40 print(" eric5_api [options] files...")
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 print()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 print("where files can be either python modules, package")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 print("directories or ordinary directories.")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 print()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 print("Options:")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 print()
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
47 print(" -b name or --base=name")
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 print(" Use the given name as the name of the base package.")
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
49 print(" -e eol-type or --eol=eol-type")
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
50 print(" Use the given eol type to terminate lines.")
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
51 print(" Valid values are 'cr', 'lf' and 'crlf'.")
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
52 print(" --exclude-file=pattern")
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
53 print(" Specify a filename pattern of files to be excluded.")
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
54 print(" This option may be repeated multiple times.")
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 print(" -h or --help")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 print(" Show this help and exit.")
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
57 print(" -l language or --language=language")
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
58 print(" Generate an API file for the given programming language.")
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
59 print(" Supported programming languages are:")
2008
1ed291dbd2d5 Fixed an issue causing a wrong help text for eric5_api.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
60 for lang in sorted(DocumentationTools.supportedExtensionsDictForApis.keys()):
1ed291dbd2d5 Fixed an issue causing a wrong help text for eric5_api.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
61 print(" * {0}".format(lang))
1ed291dbd2d5 Fixed an issue causing a wrong help text for eric5_api.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
62 print(" The default is 'Python3'.")
1ed291dbd2d5 Fixed an issue causing a wrong help text for eric5_api.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
63 print(" This option may be repeated multiple times.")
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 print(" -o filename or --output=filename")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 print(" Write the API information to the named file. A '%L' placeholder")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 print(" is replaced by the language of the API file (see --language).")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 print(" -p or --private")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 print(" Include private methods and functions.")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 print(" -R, -r or --recursive")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 print(" Perform a recursive search for source files.")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 print(" -t ext or --extension=ext")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 print(" Add the given extension to the list of file extensions.")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 print(" This option may be given multiple times.")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 print(" -V or --version")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 print(" Show version information and exit.")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 print(" -x directory or --exclude=directory")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 print(" Specify a directory basename to be excluded.")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 print(" This option may be repeated multiple times.")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 sys.exit(1)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
81
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 def version():
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 Function to show the version information.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 """
908
d00447340771 Did the last changes to the Windows related install stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
86 print("""eric5_api {0}
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87
18
3b1f5d872fd7 More renaming to eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
88 Eric5 API generator.
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89
2302
f29e9405c851 Updated copyright for 2013.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2008
diff changeset
90 Copyright (c) 2004 - 2013 Detlev Offenbach <detlev@die-offenbachs.de>
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 This is free software; see the LICENSE.GPL3 for copying conditions.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
93 PARTICULAR PURPOSE.""".format(Version))
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 sys.exit(1)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
96
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 def main():
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 Main entry point into the application.
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 """
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 global supportedExtensions
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 import getopt
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 try:
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
106 opts, args = getopt.getopt(sys.argv[1:], "b:e:hl:o:pRrt:Vx:",
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
107 ["base=", "eol=", "exclude=", "exclude-file=", "extension=", "help",
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
108 "language=", "output=", "private", "recursive",
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 "version", ])
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 except getopt.error:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 usage()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
113 excludeDirs = ["CVS", ".svn", "_svn", ".ropeproject", "_ropeproject",
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 ".eric5project", "_eric5project", "dist", "build", "doc", "docs"]
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 excludePatterns = []
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 outputFileName = ""
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 recursive = False
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 basePackage = ""
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 includePrivate = False
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 progLanguages = []
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 extensions = []
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
122 newline = None
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 for k, v in opts:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 if k in ["-o", "--output"]:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 outputFileName = v
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 elif k in ["-R", "-r", "--recursive"]:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 recursive = True
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 elif k in ["-x", "--exclude"]:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 excludeDirs.append(v)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 elif k == "--exclude-file":
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 excludePatterns.append(v)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 elif k in ["-h", "--help"]:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 usage()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 elif k in ["-V", "--version"]:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 version()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 elif k in ["-t", "--extension"]:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 if not v.startswith("."):
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
139 v = ".{0}".format(v)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 extensions.append(v)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 elif k in ["-b", "--base"]:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 basePackage = v
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143 elif k in ["-p", "--private"]:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 includePrivate = True
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 elif k in ["-l", "--language"]:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 if v not in progLanguages:
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
147 if v not in \
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
148 list(DocumentationTools.supportedExtensionsDictForApis.keys()):
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
149 sys.stderr.write("Wrong language given: {0}. Aborting\n".format(v))
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 sys.exit(1)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 else:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 progLanguages.append(v)
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
153 elif k in ["-e", "--eol"]:
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
154 if v.lower() == "cr":
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
155 newline = '\r'
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
156 elif v.lower() == "lf":
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
157 newline = '\n'
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
158 elif v.lower() == "crlf":
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
159 newline = '\r\n'
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 if not args:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 usage()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 if outputFileName == "":
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 sys.stderr.write("No output file given. Aborting\n")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 sys.exit(1)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 if len(progLanguages) == 0:
40
c2e5472b112c Changed some code to adjust eric5 to Python3.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 18
diff changeset
169 progLanguages = ["Python3"]
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 for progLanguage in sorted(progLanguages):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 basename = ""
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 apis = []
1342
30226d5a7ffb Added code to write base class information to be used by the eric assistant plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
174 basesDict = {}
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176 supportedExtensions = \
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 DocumentationTools.supportedExtensionsDictForApis[progLanguage]
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 supportedExtensions.extend(extensions)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 if "%L" in outputFileName:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 outputFile = outputFileName.replace("%L", progLanguage)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 else:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 if len(progLanguages) == 1:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 outputFile = outputFileName
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 else:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 root, ext = os.path.splitext(outputFileName)
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
186 outputFile = "{0}-{1}{2}".format(root, progLanguage.lower(), ext)
1342
30226d5a7ffb Added code to write base class information to be used by the eric assistant plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
187 basesFile = os.path.splitext(outputFile)[0] + '.bas'
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 for arg in args:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 if os.path.isdir(arg):
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
191 if os.path.exists(os.path.join(arg,
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 Utilities.joinext("__init__", ".py"))):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 basename = os.path.dirname(arg)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194 if arg == '.':
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 sys.stderr.write("The directory '.' is a package.\n")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 sys.stderr.write("Please repeat the call giving its real name.\n")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 sys.stderr.write("Ignoring the directory.\n")
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198 continue
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 else:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 basename = arg
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 if basename:
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
202 basename = "{0}{1}".format(basename, os.sep)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 if recursive and not os.path.islink(arg):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 names = [arg] + Utilities.getDirs(arg, excludeDirs)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 else:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 names = [arg]
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 else:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 basename = ""
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 names = [arg]
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 for filename in sorted(names):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 inpackage = False
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 if os.path.isdir(filename):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 files = []
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 for ext in supportedExtensions:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 files.extend(glob.glob(os.path.join(filename,
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 Utilities.joinext("*", ext))))
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
219 initFile = os.path.join(filename,
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 Utilities.joinext("__init__", ext))
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221 if initFile in files:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222 inpackage = True
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 files.remove(initFile)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 files.insert(0, initFile)
788
5b1b59777460 Added a feature where flags can be given at the end of a source file. The only flag supported is 'FileType' to overwrite the filetype detection mechanism.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 433
diff changeset
225 elif progLanguage != "Python3":
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 # assume package
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 inpackage = True
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 else:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 if Utilities.isWindowsPlatform() and glob.has_magic(filename):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 files = glob.glob(filename)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 else:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 files = [filename]
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 for file in files:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 skipIt = False
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 for pattern in excludePatterns:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 if fnmatch.fnmatch(os.path.basename(file), pattern):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 skipIt = True
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 break
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 if skipIt:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 continue
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 try:
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
244 module = Utilities.ModuleParser.readModule(file,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
245 basename=basename, inpackage=inpackage)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 apiGenerator = APIGenerator(module)
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
247 api = apiGenerator.genAPI(True, basePackage, includePrivate)
1342
30226d5a7ffb Added code to write base class information to be used by the eric assistant plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
248 bases = apiGenerator.genBases(includePrivate)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 except IOError as v:
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
250 sys.stderr.write("{0} error: {1}\n".format(file, v[1]))
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 continue
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 except ImportError as v:
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
253 sys.stderr.write("{0} error: {1}\n".format(file, v))
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 continue
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 for apiEntry in api:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 if not apiEntry in apis:
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 apis.append(apiEntry)
1342
30226d5a7ffb Added code to write base class information to be used by the eric assistant plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
259 for basesEntry in bases:
30226d5a7ffb Added code to write base class information to be used by the eric assistant plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
260 if bases[basesEntry]:
30226d5a7ffb Added code to write base class information to be used by the eric assistant plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
261 basesDict[basesEntry] = bases[basesEntry][:]
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
262 sys.stdout.write("-- {0} -- {1} ok\n".format(progLanguage, file))
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 outdir = os.path.dirname(outputFile)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 if outdir and not os.path.exists(outdir):
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 os.makedirs(outdir)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 try:
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 908
diff changeset
268 out = open(outputFile, "w", encoding="utf-8", newline=newline)
253
3ccdf551bde7 Changed code to improve development on multiple platforms.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 245
diff changeset
269 out.write("\n".join(sorted(apis)) + "\n")
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 out.close()
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 except IOError as v:
433
988006cb898f Did some more string format conversions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 253
diff changeset
272 sys.stderr.write("{0} error: {1}\n".format(outputFile, v[1]))
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 sys.exit(3)
1342
30226d5a7ffb Added code to write base class information to be used by the eric assistant plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
274 try:
30226d5a7ffb Added code to write base class information to be used by the eric assistant plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
275 out = open(basesFile, "w", encoding="utf-8", newline=newline)
30226d5a7ffb Added code to write base class information to be used by the eric assistant plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
276 for baseEntry in sorted(basesDict.keys()):
30226d5a7ffb Added code to write base class information to be used by the eric assistant plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
277 out.write("{0} {1}\n".format(
30226d5a7ffb Added code to write base class information to be used by the eric assistant plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
278 baseEntry, " ".join(sorted(basesDict[baseEntry]))))
30226d5a7ffb Added code to write base class information to be used by the eric assistant plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
279 out.close()
30226d5a7ffb Added code to write base class information to be used by the eric assistant plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
280 except IOError as v:
30226d5a7ffb Added code to write base class information to be used by the eric assistant plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
281 sys.stderr.write("{0} error: {1}\n".format(basesFile, v[1]))
30226d5a7ffb Added code to write base class information to be used by the eric assistant plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
282 sys.exit(3)
15
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 sys.stdout.write('\nDone.\n')
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 sys.exit(0)
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286
f6ccc31d6e72 Started to rename stuff for eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 if __name__ == '__main__':
18
3b1f5d872fd7 More renaming to eric5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 15
diff changeset
288 main()

eric ide

mercurial