8000 Add texinfo build target in doc/make.py by tkf · Pull Request #986 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Add texinfo build target in doc/make.py #986

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 20, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,10 @@
rst_epilog = """
.. |minimum_numpy_version| replace:: %s
""" % matplotlib.__version__numpy__

texinfo_documents = [
("contents", 'matplotlib', 'Matplotlib Documentation',
'Darren Dale@*Michael Droettboom@*Eric Firing@*John Hunter',
'Matplotlib', "Python plotting package", 'Programming',
1),
]
23 changes: 22 additions & 1 deletion doc/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ def copy_if_out_of_date(original, derived):

def check_build():
build_dirs = ['build', 'build/doctrees', 'build/html', 'build/latex',
'_static', '_templates']
'build/texinfo', '_static', '_templates']
for d in build_dirs:
try:
os.mkdir(d)
Expand Down Expand Up @@ -173,6 +173,26 @@ def latex():
else:
print('latex build has not been tested on windows')

def texinfo():
check_build()
#figs()
if sys.platform != 'win32':
# Texinfo format.
if os.system(
'sphinx-build -b texinfo -d build/doctrees . build/texinfo'):
raise SystemExit("Building Texinfo failed.")

# Produce info file.
os.chdir('build/texinfo')

# Call the makefile produced by sphinx...
if os.system('make'):
raise SystemExit("Rendering Texinfo failed.")

os.chdir('../..')
else:
print('texinfo build has not been tested on windows')

def clean():
shutil.rmtree("build", ignore_errors=True)
shutil.rmtree("examples", ignore_errors=True)
Expand All @@ -198,6 +218,7 @@ def all():
'figs' : figs,
'html' : html,
'latex' : latex,
'texinfo' : texinfo,
'clean' : clean,
'sf' : sf,
'sfpdf' : sfpdf,
Expand Down
12 changes: 12 additions & 0 deletions lib/matplotlib/sphinxext/plot_directive.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,16 @@ def split_code_at_show(text):
.. image:: {{ build_dir }}/{{ img.basename }}.pdf
{% endfor %}

{{ only_texinfo }}

{% for img in images %}
.. image:: {{ build_dir }}/{{ img.basename }}.png
{%- for option in options %}
{{ option }}
{% endfor %}

{% endfor %}

"""

exception_template = """
Expand Down Expand Up @@ -726,6 +736,7 @@ def run(arguments, content, options, state_machine, state, lineno):

only_html = ".. only:: html"
only_latex = ".. only:: latex"
only_texinfo = ".. only:: texinfo"

if j == 0:
src_link = source_link
Expand All @@ -740,6 +751,7 @@ def run(arguments, content, options, state_machine, state, lineno):
multi_image=len(images) > 1,
only_html=only_html,
only_latex=only_latex,
only_texinfo=only_texinfo,
options=opts,
images=images,
source_code=source_code,
Expand Down
0