-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly specify the source path to a logo to copy_asset_file #1746
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks correct to me, but hopefully @12rambau has time to look too, as I think he wrote much of the logic for handling light/dark logos. If not, I'll merge later this week.
src/pydata_sphinx_theme/logo.py
Outdated
@@ -78,4 +78,4 @@ def copy_logo_images(app: Sphinx, exception=None) -> None: | |||
f"The {kind} logo path '{path_image}' looks like a Sphinx template; " | |||
"please provide a static logo image." | |||
) | |||
copy_asset_file(path_image, staticdir) | |||
copy_asset_file(str(Path(app.srcdir) / path_image), staticdir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on second look, I'm not sure this is correct. If the logo path is supposed to be relative to conf.py
then shouldn't this be:
copy_asset_file(str(Path(app.srcdir) / path_image), staticdir) | |
copy_asset_file(str(Path(app.confdir) / path_image), staticdir) |
(docs: https://www.sphinx-doc.org/en/master/extdev/appapi.html#sphinx-runtime-information)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the reason is that it's already referencing (Path(app.srcdir) / path_image)
on line 73:
if not (Path(app.srcdir) / path_image).exists():
We likely want to use a variable and reuse it to make sure there is no inconsistencies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and copy_asset_file(path_image, staticdir)
was wrong as afaict, this was referencing path relative to CWD, and just silently do nothing if the source does not exist.
I've pushed an extra commit. As the code on line 73 was checking existence with respect |
(we can potentially loop on both/warn/deprecate the wrong one). |
Coverage reportClick to see where and how coverage changed
This report was generated by python-coverage-comment-action |
Ok, let's get that in, if we want to change from srcdir ton confdir we'll do that later. |
I think this fixes #1385, I think that bug report is expecting to be able to pass a logo in the
docs/_static
directory but according to the docs here: https://pydata-sphinx-theme.readthedocs.io/en/stable/user_guide/branding.html#different-logos-for-light-and-dark-mode the path should be relative to conf.py.I think the actual bug is that we were not passing the correct source to the sphinx copy function which exits silently (for some reason) if the source does not exist.