do_sphinx.py
30 lines
| 944 B
| text/x-python
|
PythonLexer
/ doc / do_sphinx.py
vivainio2
|
r1170 | import fileinput,os,sys | ||
Ville M. Vainio
|
r1167 | |||
Ville M. Vainio
|
r1118 | def oscmd(c): | ||
Ville M. Vainio
|
r1167 | os.system(c) | ||
vivainio2
|
r1170 | # html manual. | ||
Ville M. Vainio
|
r1167 | oscmd('sphinx-build -d build/doctrees source build/html') | ||
if sys.platform != 'win32': | ||||
vivainio2
|
r1170 | # LaTeX format. | ||
Ville M. Vainio
|
r1167 | oscmd('sphinx-build -b latex -d build/doctrees source build/latex') | ||
vivainio2
|
r1170 | |||
# Produce pdf. | ||||
Ville M. Vainio
|
r1167 | os.chdir('build/latex') | ||
vivainio2
|
r1170 | |||
# Change chapter style to section style: allows chapters to start on the current page. Works much better for the short chapters we have. | ||||
for line in fileinput.FileInput('manual.cls',inplace=1): | ||||
line=line.replace('py@OldChapter=\chapter','py@OldChapter=\section') | ||||
print line, | ||||
# Copying the makefile produced by sphinx... | ||||
Ville M. Vainio
|
r1167 | 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') | ||||
vivainio2
|
r1170 | |||
Ville M. Vainio
|
r1167 | os.chdir('../..') | ||