mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
modified sphinx-build script to allow for auto-generation of docs
This commit is contained in:
@@ -42,6 +42,7 @@ Options: -b <builder> -- builder to use; default is html
|
||||
-N -- do not do colored output
|
||||
-q -- no output on stdout, just warnings on stderr
|
||||
-P -- run Pdb on exception
|
||||
-g <path> -- create autogenerated files
|
||||
Modi:
|
||||
* without -a and without filenames, write new and changed files.
|
||||
* with -a, write all files.
|
||||
@@ -59,7 +60,7 @@ def main(argv=sys.argv):
|
||||
nocolor()
|
||||
|
||||
try:
|
||||
opts, args = getopt.getopt(argv[1:], 'ab:d:c:D:NEqP')
|
||||
opts, args = getopt.getopt(argv[1:], 'ab:d:c:D:g:NEqP')
|
||||
srcdir = confdir = path.abspath(args[0])
|
||||
if not path.isdir(srcdir):
|
||||
print >>sys.stderr, 'Error: Cannot find source directory.'
|
||||
@@ -84,6 +85,7 @@ def main(argv=sys.argv):
|
||||
err = 1
|
||||
if err:
|
||||
return 1
|
||||
|
||||
|
||||
buildername = all_files = None
|
||||
freshenv = use_pdb = False
|
||||
@@ -91,7 +93,19 @@ def main(argv=sys.argv):
|
||||
confoverrides = {}
|
||||
doctreedir = path.join(outdir, '.doctrees')
|
||||
for opt, val in opts:
|
||||
if opt == '-b':
|
||||
|
||||
if opt == '-g':
|
||||
print 'in here'
|
||||
source_filenames =[srcdir+'/'+f for f in os.listdir(srcdir) if f.endswith('.rst')]
|
||||
if val is None:
|
||||
print >>sys.stderr, \
|
||||
'Error: you must provide a destination directory for autodoc generation.'
|
||||
return 1
|
||||
p = path.abspath(val)
|
||||
from sphinx.ext.autosummary.generate import generate_autosummary_docs
|
||||
generate_autosummary_docs(source_filenames, p)
|
||||
|
||||
elif opt == '-b':
|
||||
buildername = val
|
||||
elif opt == '-a':
|
||||
if filenames:
|
||||
|
||||
Reference in New Issue
Block a user