sphinx icon indicating copy to clipboard operation
sphinx copied to clipboard

Config: native 'SOURCE_DATE_EPOCH' pattern-replacement support

Open jayaddison opened this issue 6 months ago • 1 comments

Purpose

Sphinx provides support for a %Y year-substitution pattern that dynamically places the publication year into the copyright and project_copyright configuration settings.

Additionally, we attempt to support reproducible builds when possible, using the SOURCE_DATE_EPOCH environment variable.

Previously, it was possible in some cases for %Y values to be replaced with reproducible output when the settings produced by evaluate_copyright_placeholders were compatible with the patterns matched by the subsequently-run correct_copyright_year method. In particular, this required use of ASCII hyphens as year-range separators (e.g. 2000-%Y would accept and allow publication year replacement since it uses an ASCII hyphen, but 2000–%Y would not, because that latter string uses an en-dash character as the range indicator).

To remove the requirement that these two methods are interleaved to function correctly, and to allow evaluate_copyright_placeholders to emit reproducible results for more-general-case patterns, allow that method to support SOURCE_DATE_EPOCH internally.

References

  • Resolves #13526.
  • Relates-to / supports lmfit/uncertainties#312.

Also depends upon a small fixup from #13537 to ensure that the test suite passes reliably when run in entirety.

jayaddison avatar May 09 '25 12:05 jayaddison

don't worry about merging master, it takes up CI resource, we have a limit of ~15(?) concurrent jobs on the whole organisation

AA-Turner avatar May 12 '25 17:05 AA-Turner

@AA-Turner I think this is ready, if/when you have time for another review.

jayaddison avatar Aug 27 '25 22:08 jayaddison