##// END OF EJS Templates
Work to address the review comments on Fernando's branch....
Work to address the review comments on Fernando's branch. * Added comment about Magic(object) (r1224) * Moved InteractiveTB.set_mode from IPythonApp -> InteractiveShell (r1229) * Moved pylabtools.py to IPython/lib (r1229) * Cleaned up comments and copyrights in testing (r1233) * Added comment about ip.shell._ofind (r1237) * Removed "Bye." from quitter (r1240). * Refactored and removed :mod:`IPython.utils.genutils` and :mod:`IPython.utils.platutils`. These modules have been replaced by topical focused modules in :mod:`IPython.utils`. * Refactored tests in :mod:`IPython.utils.tests`. * Moved :func:`IPython.testing.tools.temp_pyfile` to :mod:`IPython.utils.io`. * Moved :func:`IPython.testing.tools.cmd2argv` to :func:`IPython.testing.tools.pycmd2argv` and documented the fact that this only works with Python based command line programs. * Created a new :func:`IPython.utils.path.get_ipython_module_path` to use in finding paths to IPython modules.

File last commit:

r1248:19e3b286
r2498:3eae1372
Show More
do_sphinx.py
74 lines | 2.0 KiB | text/x-python | PythonLexer
#!/usr/bin/env python
"""Script to build documentation using Sphinx.
"""
import fileinput,os,sys
def oscmd(c):
os.system(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.getcwd()
os.chdir('build/latex')
# 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.
chapter_cmds=r'''
% Local changes.
\renewcommand\chapter{
\thispagestyle{plain}
\global\@topnum\z@
\@afterindentfalse
\secdef\@chapter\@schapter
}
\def\@makechapterhead#1{
\vspace*{10\p@}
{\raggedright \reset@font \Huge \bfseries \thechapter \quad #1}
\par\nobreak
\hrulefill
\par\nobreak
\vspace*{10\p@}
}
\def\@makeschapterhead#1{
\vspace*{10\p@}
{\raggedright \reset@font \Huge \bfseries #1}
\par\nobreak
\hrulefill
\par\nobreak
\vspace*{10\p@}
}
'''
unmodified=True
for line in fileinput.FileInput('manual.cls',inplace=1):
if 'Support for module synopsis' in line and unmodified:
line=chapter_cmds+line
elif 'makechapterhead' in line:
# Already have altered manual.cls: don't need to again.
unmodified=False
print line,
# Copying the makefile produced by sphinx...
oscmd('pdflatex ipython.tex')
oscmd('pdflatex ipython.tex')
oscmd('pdflatex ipython.tex')
oscmd('makeindex -s python.ist ipython.idx')
oscmd('makeindex -s python.ist modipython.idx')
oscmd('pdflatex ipython.tex')
oscmd('pdflatex ipython.tex')
# Create a manual/ directory with final html/pdf output
os.chdir(topdir)
oscmd('rm -rf manual')
oscmd('mkdir manual')
oscmd('cp -r build/html/*.html build/html/_static manual/')
oscmd('cp build/latex/ipython.pdf manual/')