Repository navigation
Put savefig images back in source directory - #10186
Conversation
Simplifying the logic a bit. I think there was an issue with the way we were finding the source directory: when it included a docstring from code, the source directory was that of the code. This always uses the main source directory of the docs. Closes ipythongh-8733
| outfile = os.path.relpath(os.path.join(savefig_dir,filename), | ||
| source_dir) | ||
| # insert relative path to image file in source (as absolute path for Sphinx) | ||
| outfile = '/' + os.path.relpath(os.path.join(savefig_dir,filename), |
There was a problem hiding this comment.
I believe / is right, because it's effectively a URL rather than a platform path. We write all the paths in rst files with forward slashes. I suspect this means it shouldn't be doing os.path.join() either, but I didn't want to change more than I needed to at the moment.
|
+1 |
|
I think this should work. |
|
Yes, this solved our problem on read the docs. Thanks! |
|
@meeseeksdev backport to 5.x |
Simplifying the logic a bit. I think there was an issue with the way we were finding the source directory: when it included a docstring from code, the source directory was that of the code. This always uses the main source directory of the docs. Closes gh-8733
Backport PR #10186 on branch 5.x
|
This fails on Windows. Not sure but seems like Sphinx removes the "\" from I have also set Using it right now for documenting a Windows app, so to make it work, I simply added if os.name == 'nt':
outfile = outfile.replace('\\', '/')Not sure if it's the best way. |
Simplifying the logic a bit.
I think there was an issue with the way we were finding the source directory: when it included a docstring from code, the source directory was that of the code. This always uses the main source directory of the docs.
Closes gh-8733