24 from DocumentationTools.Config import eric5docDefaultColors |
24 from DocumentationTools.Config import eric5docDefaultColors |
25 from UI.Info import Version |
25 from UI.Info import Version |
26 import Utilities |
26 import Utilities |
27 |
27 |
28 # list of supported filename extensions |
28 # list of supported filename extensions |
29 supportedExtensions = [".py", ".pyw", ".ptl", ".rb"] |
29 supportedExtensions = [".py", ".pyw", ".ptl", ".rb"] |
|
30 |
30 |
31 |
31 def usage(): |
32 def usage(): |
32 """ |
33 """ |
33 Function to print some usage information. |
34 Function to print some usage information. |
34 |
35 |
137 |
140 |
138 try: |
141 try: |
139 opts, args = getopt.getopt(sys.argv[1:], "c:ehio:Rrt:Vx:", |
142 opts, args = getopt.getopt(sys.argv[1:], "c:ehio:Rrt:Vx:", |
140 ["exclude=", "extension=", "help", "noindex", "noempty", "outdir=", |
143 ["exclude=", "extension=", "help", "noindex", "noempty", "outdir=", |
141 "recursive", "style-sheet=", "version", |
144 "recursive", "style-sheet=", "version", |
142 "exclude-file=", "eol=", |
145 "exclude-file=", "eol=", |
143 "body-color=", "body-background-color=", |
146 "body-color=", "body-background-color=", |
144 "l1header-color=", "l1header-background-color=", |
147 "l1header-color=", "l1header-background-color=", |
145 "l2header-color=", "l2header-background-color=", |
148 "l2header-color=", "l2header-background-color=", |
146 "cfheader-color=", "cfheader-background-color=", |
149 "cfheader-color=", "cfheader-background-color=", |
147 "link-color=", |
150 "link-color=", |
148 "create-qhp", "qhp-outdir=", "qhp-namespace=", |
151 "create-qhp", "qhp-outdir=", "qhp-namespace=", |
149 "qhp-virtualfolder=", "qhp-filtername=", "qhp-filterattribs=", |
152 "qhp-virtualfolder=", "qhp-filtername=", "qhp-filterattribs=", |
150 "qhp-title=", "create-qhc", |
153 "qhp-title=", "create-qhc", |
151 ]) |
154 ]) |
152 except getopt.error: |
155 except getopt.error: |
153 usage() |
156 usage() |
154 |
157 |
155 excludeDirs = ["CVS", ".svn", "_svn", ".ropeproject", "_ropeproject", |
158 excludeDirs = ["CVS", ".svn", "_svn", ".ropeproject", "_ropeproject", |
156 ".eric5project", "_eric5project", "dist", "build", "doc", "docs"] |
159 ".eric5project", "_eric5project", "dist", "build", "doc", "docs"] |
157 excludePatterns = [] |
160 excludePatterns = [] |
158 outputDir = "doc" |
161 outputDir = "doc" |
159 recursive = False |
162 recursive = False |
160 doIndex = True |
163 doIndex = True |
291 sys.exit(2) |
294 sys.exit(2) |
292 else: |
295 else: |
293 qtHelpOutputDir = os.getcwd() |
296 qtHelpOutputDir = os.getcwd() |
294 qtHelpOutputDir = os.path.abspath(qtHelpOutputDir) |
297 qtHelpOutputDir = os.path.abspath(qtHelpOutputDir) |
295 |
298 |
296 qtHelpGenerator = QtHelpGenerator(outputDir, |
299 qtHelpGenerator = QtHelpGenerator(outputDir, |
297 qtHelpOutputDir, qtHelpNamespace, qtHelpFolder, |
300 qtHelpOutputDir, qtHelpNamespace, qtHelpFolder, |
298 qtHelpFilterName, qtHelpFilterAttribs, |
301 qtHelpFilterName, qtHelpFilterAttribs, |
299 qtHelpTitle, qtHelpCreateCollection) |
302 qtHelpTitle, qtHelpCreateCollection) |
300 |
303 |
301 for arg in args: |
304 for arg in args: |
302 if os.path.isdir(arg): |
305 if os.path.isdir(arg): |
303 if os.path.exists(os.path.join(arg, Utilities.joinext("__init__", ".py"))): |
306 if os.path.exists(os.path.join(arg, Utilities.joinext("__init__", ".py"))): |
346 break |
349 break |
347 if skipIt: |
350 if skipIt: |
348 continue |
351 continue |
349 |
352 |
350 try: |
353 try: |
351 module = Utilities.ModuleParser.readModule(file, basename = basename, |
354 module = Utilities.ModuleParser.readModule(file, basename=basename, |
352 inpackage = inpackage, extensions = supportedExtensions) |
355 inpackage=inpackage, extensions=supportedExtensions) |
353 moduleDocument = ModuleDocument(module, colors, stylesheet) |
356 moduleDocument = ModuleDocument(module, colors, stylesheet) |
354 doc = moduleDocument.genDocument() |
357 doc = moduleDocument.genDocument() |
355 except IOError as v: |
358 except IOError as v: |
356 sys.stderr.write("{0} error: {1}\n".format(file, v[1])) |
359 sys.stderr.write("{0} error: {1}\n".format(file, v[1])) |
357 continue |
360 continue |