On Tue, May 31, 2011 at 9:18 PM, Skipper Seabold <jsseab...@gmail.com> wrote: > It seems that this commit [1] changed the default directory for the > sphinx plots directory (now needs to be alongside the directive and > not in the directory above it?) and now our project's docs will not > build across different versions of matplotlib without some magic. So I > tried setting > > from os.path import dirname, abspath > plot_basedir = dirname(dirname(abspath(__file__))) > > in our sphinx conf.py. We have source/conf.py and plots/ is in the > parent directory of source for the directive plot:: > plots/some_file.py. However, now I get this error [2] and this > traceback [3]. It seems the build/plot_directive folder is created > before a subsequent call to os.makedir. If I move plots to its > expected default location and then set the plot_basedir manually it's > fine. Is this a bug or user error? Is there some reason our plots > directory can't be in the parent directory of source? > > [1] > https://github.com/matplotlib/matplotlib/commit/a205f5460f13d47aa5b5fad662005c382dd096ee > [2] http://pastebin.com/KQp11CiS > [3] http://pastebin.com/4LY1Pt1Q > > Skipper >
Ok, there were two things going on here. First, when build_dir is created it is joined with a relative path that will include '..' if necessary. matplotlib.cbook.mkdirs does not handle this correctly, but os.makedirs does. Is there a good reason to keep cbook.mkdirs? This problem could also be solved with a call to os.path.normpath, which is needed for the next issue anyway. Second, since we call our source folder plots, there is a conflict when trying to copy it over at the end to the destination directory. This commit adds a call to os.path.normpath, replaces cbook.mkdirs with os.makedirs, and only copies the plots to the destination directory if there's a need. https://github.com/matplotlib/matplotlib/pull/132 Skipper ------------------------------------------------------------------------------ Simplify data backup and recovery for your virtual environment with vRanger. Installation's a snap, and flexible recovery options mean your data is safe, secure and there when you need it. Discover what all the cheering's about. Get your free trial download today. http://p.sf.net/sfu/quest-dev2dev2 _______________________________________________ Matplotlib-devel mailing list Matplotlib-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-devel