You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, some projects don't define the author and up until Sphinx 7.1.1 this was an input that successfully generated the pages: copyright = "2010"
For environments where SOURCE_DATE_EPOCH is not set, which is possibly the most often encountered use case, this still works. The value of the copyright key is taken in the exact form as it's defined in conf.py.
If SOURCE_DATE_EPOCH is set (like in the RPM build I invoked when building a project in Fedora Linux 40), the value read from conf.py is processed via the logic introduced here: 8452300
That produces an index error for inputs like the one above
def _substitute_copyright_year(copyright_line: str, replace_year: str) -> str:
"""Replace the year in a single copyright line.
Legal formats are:
* ``YYYY,``
* ``YYYY ``
* ``YYYY-YYYY,``
* ``YYYY-YYYY ``
The final year in the string is replaced with ``replace_year``.
"""
if not copyright_line[:4].isdigit():
return copyright_line
> if copyright_line[4] in ' ,':
E IndexError: string index out of range
resulting in a rather cryptic output of the app:
E sphinx.errors.ExtensionError: Handler <function correct_copyright_year at 0x7f534334aba0> for event 'config-inited' threw an exception (exception: string index out of range)
This behavior is inconsistent, I'd prefer Sphinx either allowed the customary copyright in the form of a year only, or validated the correct format in both cases.
How to Reproduce
change tests/roots/test-copyright-multiline/conf.py to:
Describe the bug
Docs say the copyright comes with a form of: '2008, Author Name'.
https://www.sphinx-doc.org/en/master/usage/configuration.html#confval-copyright
However, some projects don't define the author and up until Sphinx 7.1.1 this was an input that successfully generated the pages:
copyright = "2010"
For environments where
SOURCE_DATE_EPOCH
is not set, which is possibly the most often encountered use case, this still works. The value of thecopyright
key is taken in the exact form as it's defined inconf.py
.If
SOURCE_DATE_EPOCH
is set (like in the RPM build I invoked when building a project in Fedora Linux 40), the value read fromconf.py
is processed via the logic introduced here: 8452300That produces an index error for inputs like the one above
resulting in a rather cryptic output of the app:
This behavior is inconsistent, I'd prefer Sphinx either allowed the customary copyright in the form of a year only, or validated the correct format in both cases.
How to Reproduce
change
tests/roots/test-copyright-multiline/conf.py
to:Run tox tests.
Test without the envvar set will pass while the ones with it will fail.
Environment Information
Sphinx extensions
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: