src/eric7/eric7_doc.py

branch
eric7
changeset 9211
99eb1cb030a5
parent 9209
b99e7fd55fd3
child 9221
bf71ee032bb4
equal deleted inserted replaced
9210:15743bae8a50 9211:99eb1cb030a5
72 print(" Don't generate index files.") 72 print(" Don't generate index files.")
73 print(" -o directory or --outdir=directory") 73 print(" -o directory or --outdir=directory")
74 print(" Generate files in the named directory.") 74 print(" Generate files in the named directory.")
75 print(" -R, -r or --recursive") 75 print(" -R, -r or --recursive")
76 print(" Perform a recursive search for Python files.") 76 print(" Perform a recursive search for Python files.")
77 print(" -s directory or --startdir=directory")
78 print(" Start the documentation generation in the given directory.")
77 print(" -t ext or --extension=ext") 79 print(" -t ext or --extension=ext")
78 print(" Add the given extension to the list of file extensions.") 80 print(" Add the given extension to the list of file extensions.")
79 print(" This option may be given multiple times.") 81 print(" This option may be given multiple times.")
80 print(" -V or --version") 82 print(" -V or --version")
81 print(" Show version information and exit.") 83 print(" Show version information and exit.")
149 """ 151 """
150 import getopt 152 import getopt
151 153
152 try: 154 try:
153 opts, args = getopt.getopt( 155 opts, args = getopt.getopt(
154 sys.argv[1:], "c:ehio:Rrt:Vx:", 156 sys.argv[1:], "c:ehio:Rrs:t:Vx:",
155 ["exclude=", "extension=", "help", "noindex", "noempty", "outdir=", 157 ["exclude=", "extension=", "help", "noindex", "noempty", "outdir=",
156 "recursive", "style-sheet=", "version", 158 "recursive", "startdir=", "style-sheet=", "version",
157 "exclude-file=", "eol=", 159 "exclude-file=", "eol=",
158 "body-color=", "body-background-color=", 160 "body-color=", "body-background-color=",
159 "l1header-color=", "l1header-background-color=", 161 "l1header-color=", "l1header-background-color=",
160 "l2header-color=", "l2header-background-color=", 162 "l2header-color=", "l2header-background-color=",
161 "cfheader-color=", "cfheader-background-color=", 163 "cfheader-color=", "cfheader-background-color=",
166 ]) 168 ])
167 except getopt.error: 169 except getopt.error:
168 usage() 170 usage()
169 171
170 excludeDirs = [".svn", ".hg", ".git", ".ropeproject", ".eric7project", 172 excludeDirs = [".svn", ".hg", ".git", ".ropeproject", ".eric7project",
171 "dist", "build", "doc", "docs"] 173 ".jedi", "dist", "build", "doc", "docs"]
172 excludePatterns = [] 174 excludePatterns = []
175 startDir = ""
173 outputDir = "doc" 176 outputDir = "doc"
174 recursive = False 177 recursive = False
175 doIndex = True 178 doIndex = True
176 noempty = False 179 noempty = False
177 newline = None 180 newline = None
187 qtHelpFilterAttribs = "" 190 qtHelpFilterAttribs = ""
188 qtHelpTitle = "" 191 qtHelpTitle = ""
189 qtHelpCreateCollection = False 192 qtHelpCreateCollection = False
190 193
191 for k, v in opts: 194 for k, v in opts:
192 if k in ["-o", "--outdir"]: 195 if k in ["-s", "--startdir"]:
196 startDir = v
197 elif k in ["-o", "--outdir"]:
193 outputDir = v 198 outputDir = v
194 elif k in ["-R", "-r", "--recursive"]: 199 elif k in ["-R", "-r", "--recursive"]:
195 recursive = True 200 recursive = True
196 elif k in ["-x", "--exclude"]: 201 elif k in ["-x", "--exclude"]:
197 excludeDirs.append(v) 202 excludeDirs.append(v)
319 qtHelpOutputDir, qtHelpNamespace, 324 qtHelpOutputDir, qtHelpNamespace,
320 qtHelpFolder, qtHelpFilterName, 325 qtHelpFolder, qtHelpFilterName,
321 qtHelpFilterAttribs, qtHelpTitle, 326 qtHelpFilterAttribs, qtHelpTitle,
322 qtHelpCreateCollection) 327 qtHelpCreateCollection)
323 328
329 if startDir:
330 os.chdir(os.path.abspath(startDir))
331
324 for arg in args: 332 for arg in args:
325 if os.path.isdir(arg): 333 if os.path.isdir(arg):
326 if os.path.exists(os.path.join( 334 if os.path.exists(os.path.join(
327 arg, Utilities.joinext("__init__", ".py"))): 335 arg, Utilities.joinext("__init__", ".py"))):
328 basename = os.path.dirname(arg) 336 basename = os.path.dirname(arg)

eric ide

mercurial