sphinx
sphinx copied to clipboard
config: Add further preconditions before copyright notice year substitution occurs
Feature or Bugfix
- Bugfix
Purpose
- ~~Allow downstream projects to opt-out of copyright year substitution using a configuration setting.~~
- Reduce the number of cases where substitution occurs -- ideally only to cases where the downstream project has configured the current year to appear dynamically in
conf.py. - Achieve both of the above without directly affecting the number of downstream projects that build reproducibly.
Detail
- ~~Adds a default-enabled
copyright_build_year_substitutionconfig setting.~~ - Only replaces copyright years that match the system's local clock time year. This is intended to match against the vast majority of downstream dynamic
conf.pycopyright notices that are configured to containdatetime.today().yearor similar as current-year. - Only replace copyright years when the
SOURCE_DATE_EPOCH(build time) is ~~greater than~~ less than the matching copyright notice year.- Rationale: an end-year in a copyright line represents a publication year. It isn't valid to project a copyright line's end-year value into the future.
Relates
- Resolves #12451.
- Opening initially in 'draft' status because I'd like feedback on it - I'll likely also reference the suggested logic here in an upcoming Reproducible Builds mailing list thread.
Edit: logical fixup for greater-than vs less-than condition. Edit: typo fixup Edit: remove config setting changes
- Opening initially in 'draft' status because I'd like feedback on it - I'll likely also reference the suggested logic here in an upcoming Reproducible Builds mailing list thread.
A belated note that this discussion has begun, and can be found at: https://lists.reproducible-builds.org/pipermail/rb-general/2024-July/003458.html
- Opening initially in 'draft' status because I'd like feedback on it - I'll likely also reference the suggested logic here in an upcoming Reproducible Builds mailing list thread.
A belated note that this discussion has begun, and can be found at: https://lists.reproducible-builds.org/pipermail/rb-general/2024-July/003458.html
In hindsight: I probably should have posted this to the sphinx-dev mailing list also.
I've pushed a commit to simplify the replacements a bit, but I'm not happy with the tests at present -- we should keep the current tests and add the new ones on top, rather than replacing. I'm working on this now.
A
I'm happier with the current state, but will hold off on merging in case I've missed a test case or scenerio that you think is important to test.
A
@AA-Turner Ok, this is ready from my perspective. Thanks for adding some momentum to it.
Thank you @jayaddison -- I'll update #12910, do review that PR if you have time.
A
Thanks very much @AA-Turner - and will do :+1: