-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Description
canonical-sphinx auto-enables the sphinx_last_updated_by_git package if it's present in the venv, even when it's not added to the user extension list. When running build in non-git environments, this causes build warnings. For doc projects with --failed-on-warning enabled, it results in build failures.
This could happen in:
- builds in a Docker container without
.gitdirectory - builds from the source tarball
Expected Behavior
User settings in conf.py be able to prevent sphinx_last_updated_by_git from loading and running.
Cause
When using sphinx-sitemap extension, it installs sphinx_last_updated_by_git as a hard dependency and provides the sitemap_show_lastmod flag in conf.py to toggle the features.
However, because canonical-sphinx detects that the package is installed in the venv (config.py), it auto-loads the package during doc build even if it's not added as a project extension in conf.py. This behavior forces Sphinx builds to check for git history, and cannot be disabled by setting sitemap_show_lastmod=False.
Steps to Reproduce
- Create a starter-pack project without
.gitdirectory (e.g. by renaming the.gitor copying thedocs/dir outside the git project) - Remove
sphinx_last_updated_by_gitfrom the requirement list and extension list inconf.py, but keepsphinx-sitemap. - Set
sitemap_show_lastmod=Falseinconf.py - Re-run
make installandmake html
Output:
getting Git timestamps for source files... [100%] .
getting Git timestamps for dependencies... [100%]
WARNING: Error getting data from Git (no "last updated" dates will be shown for source files from <path>/docs/explanation):
fatal: not a git repository (or any of the parent directories): .git