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.
On Tue, May 31, 2011 at 9:18 PM, Skipper Seabold <jsseabold@...149...> wrote:
It seems that this commit  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
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  and this
traceback . 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?