Anonymous avatar Anonymous committed 585552a

Support creating a Makefile in quickstart.

Comments (0)

Files changed (3)

sphinx/__init__.py

 from sphinx.application import Sphinx
 from sphinx.util.console import nocolor
 
-__version__ = '$Revision$'[11:-2]
+__revision__ = '$Revision$'
+__version__ = '0.1.' + __revision__[11:-2]
 
 
 def usage(argv, msg=None):

sphinx/quickstart.py

 #latex_appendices = []
 '''
 
-
 MASTER_FILE = '''\
 .. %(project)s documentation master file, created by sphinx-quickstart.py on %(now)s.
    You can adapt this file completely to your liking, but it should at least
 
 '''
 
+MAKEFILE = '''\
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS   =
+SPHINXBUILD  = sphinx-build.py
+PAPER        =
+
+ALLSPHINXOPTS = -d %(rbuilddir)s/doctrees -D latex_paper_size=$(PAPER) \\
+                $(SPHINXOPTS) %(rsrcdir)s
+
+.PHONY: help clean html web htmlhelp latex changes linkcheck
+
+help:
+	@echo "Please use \\`make <target>' where <target> is one of"
+	@echo "  html      to make standalone HTML files"
+	@echo "  web       to make files usable by Sphinx.web"
+	@echo "  htmlhelp  to make HTML files and a HTML help project"
+	@echo "  latex     to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+	@echo "  changes   to make an overview over all changed/added/deprecated items"
+	@echo "  linkcheck to check all external links for integrity"
+
+clean:
+	-rm -rf %(rbuilddir)s/*
+
+html:
+	mkdir -p %(rbuilddir)s/html %(rbuilddir)s/doctrees
+	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) %(rbuilddir)s/html
+	@echo
+	@echo "Build finished. The HTML pages are in %(rbuilddir)s/html."
+
+web:
+	mkdir -p %(rbuilddir)s/web %(rbuilddir)s/doctrees
+	$(SPHINXBUILD) -b web $(ALLSPHINXOPTS) %(rbuilddir)s/web
+	@echo
+	@echo "Build finished; now you can run"
+	@echo "  python -m sphinx.web %(rbuilddir)s/web"
+	@echo "to start the server."
+
+htmlhelp:
+	mkdir -p %(rbuilddir)s/htmlhelp %(rbuilddir)s/doctrees
+	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) %(rbuilddir)s/htmlhelp
+	@echo
+	@echo "Build finished; now you can run HTML Help Workshop with the" \\
+	      ".hhp project file in %(rbuilddir)s/htmlhelp."
+
+latex:
+	mkdir -p %(rbuilddir)s/latex %(rbuilddir)s/doctrees
+	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) %(rbuilddir)s/latex
+	@echo
+	@echo "Build finished; the LaTeX files are in %(rbuilddir)s/latex."
+	@echo "Run \\`make all-pdf' or \\`make all-ps' in that directory to" \\
+	      "run these through (pdf)latex."
+
+changes:
+	mkdir -p %(rbuilddir)s/changes %(rbuilddir)s/doctrees
+	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) %(rbuilddir)s/changes
+	@echo
+	@echo "The overview file is in %(rbuilddir)s/changes."
+
+linkcheck:
+	mkdir -p %(rbuilddir)s/linkcheck %(rbuilddir)s/doctrees
+	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) %(rbuilddir)s/linkcheck
+	@echo
+	@echo "Link check complete; look for any errors in the above output " \\
+	      "or in %(rbuilddir)s/linkcheck/output.txt."
+'''
+
+
 def mkdir_p(dir):
     if path.isdir(dir):
         return
 document is a custom template, you can also set this to another filename.'''
     do_prompt(d, 'master', 'Name of your master document (without suffix)',
               'index')
+    print '''
+If you are under Unix, a Makefile can be generated for you so that you
+only have to run e.g. `make html' instead of invoking sphinx-build.py
+directly.'''
+    do_prompt(d, 'makefile', 'Create Makefile? (y/n)',
+              os.name == 'posix' and 'y' or 'n', boolean)
 
     d['year'] = time.strftime('%Y')
     d['now'] = time.asctime()
     f.write(MASTER_FILE % d)
     f.close()
 
+    if d['makefile']:
+        d['rsrcdir'] = separate and 'source' or '.'
+        d['rbuilddir'] = separate and 'build' or d['dot'] + 'build'
+        f = open(path.join(d['path'], 'Makefile'), 'w')
+        f.write(MAKEFILE % d)
+        f.close()
+
     print
     print bold('Finished: An initial directory structure has been created.')
     print '''
 You should now populate your master file %s and create other documentation
 source files. Use the sphinx-build.py script to build the docs, like so:
-
+''' % masterfile + (d['makefile'] and '''
+   make <builder>
+''' or '''
    sphinx-build.py -b <builder> %s %s
-''' % (masterfile, srcdir, builddir)
+''' % (srcdir, builddir))
 
 
 def main(argv=sys.argv):

sphinx/static/doctools.js

       this.resizeHandle = $('<div class="resizehandle"></div>').appendTo(this.root);
 
       this.root.Draggable({
-        handle:       this.title[0],
+        handle:       this.title[0]
       });
 
       this.root.css({
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.