Skip to content

[config] Support more precise build-year copyright substitution #12451

@jayaddison

Description

@jayaddison

Describe the bug

Projects can configure multiline copyright notices (ref #4925), a useful feature for projects that have transitions between copyright holders over time.

However, the current config year-substitution logic enabled when SOURCE_DATE_EPOCH is configured will attempt to pattern-match and substitute the end-year from the build-year in all of the copyright lines.

I'm not sure that's intended; I think that we should only apply the substitution for the most recent (which for an iterable I suppose means the final) line in the notice.

How to Reproduce

conf.py

copyright = [
    '2000-2001 - first copyright holder',
    '2002-2003 - second copyright holder',
]

index.rst

Example Document

Expected

['2000-2001 - first copyright holder', '2002-2024 - second copyright holder']

Actual

['2000-2024 - first copyright holder', '2002-2024 - second copyright holder']

Environment Information

Platform:              linux; (Linux-6.8.12-arm64-aarch64-with-glibc2.38)
Python version:        3.11.9 (main, Apr 10 2024, 13:16:36) [GCC 13.2.0])
Python implementation: CPython
Sphinx version:        7.4.0+/6471027d1
Docutils version:      0.21.2
Jinja2 version:        3.1.4
Pygments version:      2.18.0

Sphinx extensions

N/A

Additional context

Discovered while investigating whether multiline copyright config could be a way to reduce risk of rewriting unintended copyright lines re: any interaction between matplotlib/matplotlib#28418 and #12450.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions