Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 79 lines (69 sloc) 2.257 kb
#!/usr/bin/env python
"""Script to build documentation using Sphinx.
import fileinput,os,sys
def oscmd(c):
# html manual.
oscmd('sphinx-build -d build/doctrees source build/html')
if sys.platform != 'win32':
# LaTeX format.
oscmd('sphinx-build -b latex -d build/doctrees source build/latex')
# Produce pdf.
topdir = os.getcwdu()
# Change chapter style to section style: allows chapters to start on
# the current page. Works much better for the short chapters we have.
# This must go in the class file rather than the preamble, so we modify
# manual.cls at runtime.
% Local changes.
{\raggedright \reset@font \Huge \bfseries \thechapter \quad #1}
{\raggedright \reset@font \Huge \bfseries #1}
# manual.cls in Sphinx <= 0.6.7 became sphinxmanual.cls for 1.x
manualcls = 'sphinxmanual.cls'
if not os.path.exists(manualcls):
manualcls = 'manual.cls'
for line in fileinput.FileInput(manualcls, inplace=True):
if 'Support for module synopsis' in line and unmodified:
elif 'makechapterhead' in line:
# Already have altered manual.cls: don't need to again.
print line,
# Copying the makefile produced by sphinx...
oscmd('pdflatex ipython.tex')
oscmd('pdflatex ipython.tex')
oscmd('pdflatex ipython.tex')
oscmd('makeindex -s ipython.idx')
oscmd('makeindex -s modipython.idx')
oscmd('pdflatex ipython.tex')
oscmd('pdflatex ipython.tex')
# Create a manual/ directory with final html/pdf output
oscmd('rm -rf manual')
oscmd('mkdir manual')
oscmd('cp -r build/html/*.html build/html/_static manual/')
oscmd('cp build/latex/ipython.pdf manual/')
Jump to Line
Something went wrong with that request. Please try again.