On Thu, 09 Dec 2010 18:37:34 +0200, Jouni K. Seppänen <j...@iki.fi> wrote: > Ben Gamari <bgamari.f...@gmail.com> writes: > > > That being said, I've tracked down the reason for the configuration in > > doc/matplotlibrc not being used. It seems that sphinx runs the examples > > in their current directory (I suppose this is to be expected). > > > > It seems that there is a (as far as I can tell undocumented, please fix > > this) MATPLOTLIBRC environment variable which can be used to override > > the location of the matplotlibrc used. This could be useful in > > specifying the matplotlibrc used during the documentation build process > > but unfortunately this would require an absolute path which, again, > > complicates the packaging (i.e. I don't know the best way to accomplish > > this). Suggestions? > > I don't see why the path must be absolute, though I haven't tried. Is > there some problem having a different global matplotlibrc > $HOME/.matplotlib/matplotlibrc or $MATPLOTLIBDATA/matplotlibrc, > possibly setting $HOME or $MATPLOTLIBDATA from your build script?
An absolute path is necesary because the current working directory changes for each example. To check this I added, import sys sys.stderr.write('SAMPLE cwd=%s\n'%os.getcwd()) sys.stderr.write('SAMPLE matplotlibrc=%s\n'%matplotlib.matplotlib_fname()) to the beginning of cbook.get_sample_data(). During the documentation build I then saw output like, reading sources... [ 12%] examples/api/date_demo SAMPLE cwd=/home/bgamari/trees/matplotlib/matplotlib-1.0.1/examples/api SAMPLE matplotlibrc=/home/bgamari/.matplotlib/matplotlibrc reading sources... [ 12%] examples/api/date_index_formatter SAMPLE cwd=/home/bgamari/trees/matplotlib/matplotlib-1.0.1/examples/api SAMPLE matplotlibrc=/home/bgamari/.matplotlib/matplotlibrc I suppose the only way around this is to patch the absolute path into doc/matplotlibrc with sed, and then invoke doc/make.py with MATPLOTLIBRC="$(CURDIR)/doc/matplotlibrc". I'm very confused how you found that specifying a relative path in download.path worked. If the cwd changes as seen above then the documentation was entirely correct in claiming an absolute path is necessary. I really do wish there as a way to prevent spinx from changing the cwd. - Ben ------------------------------------------------------------------------------ _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel