sphinx-quickstart now has --use-make-mode option for generating Makefile that use sphinx make-mode.

This commit is contained in:
shimizukawa 2015-02-17 21:42:27 +09:00
parent e968a6c1a1
commit 3d3bee1c8b
3 changed files with 20 additions and 3 deletions

View File

@ -19,6 +19,8 @@ Features added
described in documentation.
* HTML breadcrumb items tag has class "nav-item" and "nav-item-N" (like
nav-item-0, 1, 2...).
* sphinx-quickstart now has `--use-make-mode` option for generating Makefile
that use sphinx make-mode.
Bugs fixed
----------

View File

@ -120,6 +120,10 @@ Extension options
Makefile and Batchfile creation options
---------------------------------------
.. option:: --use-make-mode, --no-use-make-mode
Makefile/make.bat uses (or not use) make-mode. Default is not use.
.. option:: --makefile, --no-makefile
Create (or not create) makefile.

View File

@ -947,7 +947,7 @@ help:
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%:
%%:
\t@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
'''
@ -1341,16 +1341,23 @@ def generate(d, overwrite=True, silent=False):
masterfile = path.join(srcdir, d['master'] + d['suffix'])
write_file(masterfile, MASTER_FILE % d)
if d.get('make_mode') is True:
makefile_template = MAKEFILE_NEW
batchfile_template = BATCHFILE_NEW
else:
makefile_template = MAKEFILE
batchfile_template = BATCHFILE
if d['makefile'] is True:
d['rsrcdir'] = d['sep'] and 'source' or '.'
d['rbuilddir'] = d['sep'] and 'build' or d['dot'] + 'build'
# use binary mode, to avoid writing \r\n on Windows
write_file(path.join(d['path'], 'Makefile'), MAKEFILE % d, u'\n')
write_file(path.join(d['path'], 'Makefile'), makefile_template % d, u'\n')
if d['batchfile'] is True:
d['rsrcdir'] = d['sep'] and 'source' or '.'
d['rbuilddir'] = d['sep'] and 'build' or d['dot'] + 'build'
write_file(path.join(d['path'], 'make.bat'), BATCHFILE % d, u'\r\n')
write_file(path.join(d['path'], 'make.bat'), batchfile_template % d, u'\r\n')
if silent:
return
@ -1452,6 +1459,10 @@ def main(argv=sys.argv):
group.add_option('--no-batchfile', action='store_true', dest='no_batchfile',
default=False,
help='not create batchfile')
group.add_option('-M', '--no-use-make-mode', action='store_false', dest='make_mode',
help='not use make-mode for Makefile/make.bat')
group.add_option('-m', '--use-make-mode', action='store_true', dest='make_mode',
help='use make-mode for Makefile/make.bat')
# parse options
try: