Skip to content

Loading…

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

Merged
merged 5 commits into from

5 participants

@tkf
tkf commented

No description provided.

@WeatherGod
Matplotlib Developers member

Need to add a entry for "build/texinfo" in the list in check_build() in order to make sure the directory exists.

@tkf
tkf commented

Done!

@mdboom
Matplotlib Developers member

This seems to work reasonably well. Is there a texinfo viewer that displays the images?

@tkf
tkf commented

Emacs's info viewer displays images, in principle. It works well when I build other info documents based on sphinx. But the only figure I found in the info page is http://matplotlib.sourceforge.net/users/screenshots.html#eeg-demo. Probably there is some problem in plot directive when used with texinfo builder?

@mdboom
Matplotlib Developers member

It's quite possible something is going wrong here.

Pardon my ignorance about this stuff, but how do I load the results of this build into emacs so I can test it?

@tkf
tkf commented

I think the easiest way to open info file is to do:

M-x info-open-file RET PATH/TO/matplotlib/doc/build/texinfo/matplotlib.info RET
@tkf
tkf commented

Thanks to @JonWaltman (tkf/matplotlib#1), plot directive works with texinfo build target.

@pelson
Matplotlib Developers member

There is no reason to not get this into 1.2.x. Any other issues before we merge?

@mdboom
Matplotlib Developers member

This looks good to me.

@mdboom mdboom merged commit 4cf846d into matplotlib:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 4, 2012
  1. @tkf
Commits on Jul 5, 2012
  1. @tkf
Commits on Aug 8, 2012
  1. @JonWaltman
Commits on Aug 9, 2012
  1. @tkf

    Merge pull request #1 from JonWaltman/texinfo

    tkf committed
    Add texinfo support to plot directive
  2. @tkf
Showing with 41 additions and 1 deletion.
  1. +7 −0 doc/conf.py
  2. +22 −1 doc/make.py
  3. +12 −0 lib/matplotlib/sphinxext/plot_directive.py
View
7 doc/conf.py
@@ -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),
+]
View
23 doc/make.py
@@ -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)
@@ -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)
@@ -198,6 +218,7 @@ def all():
'figs' : figs,
'html' : html,
'latex' : latex,
+ 'texinfo' : texinfo,
'clean' : clean,
'sf' : sf,
'sfpdf' : sfpdf,
View
12 lib/matplotlib/sphinxext/plot_directive.py
@@ -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 = """
@@ -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
@@ -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,
Something went wrong with that request. Please try again.