sphinx icon indicating copy to clipboard operation
sphinx copied to clipboard

config: Add further preconditions before copyright notice year substitution occurs

Open jayaddison opened this issue 1 year ago • 2 comments

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_substitution config 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.py copyright notices that are configured to contain datetime.today().year or 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

jayaddison avatar Jul 07 '24 14:07 jayaddison

  • 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

jayaddison avatar Jul 12 '24 15:07 jayaddison

  • 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.

jayaddison avatar Jul 12 '24 15:07 jayaddison

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

AA-Turner avatar Oct 03 '24 19:10 AA-Turner

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 avatar Oct 03 '24 21:10 AA-Turner

@AA-Turner Ok, this is ready from my perspective. Thanks for adding some momentum to it.

jayaddison avatar Oct 04 '24 00:10 jayaddison

Thank you @jayaddison -- I'll update #12910, do review that PR if you have time.

A

AA-Turner avatar Oct 04 '24 09:10 AA-Turner

Thanks very much @AA-Turner - and will do :+1:

jayaddison avatar Oct 04 '24 09:10 jayaddison