8000 doc/conf.py: if set, use SOURCE_DATE_EPOCH to set copyright year. · ianhi/matplotlib@16ca8be · GitHub
[go: up one dir, main page]

Skip to content

Commit 16ca8be

Browse files
committed
doc/conf.py: if set, use SOURCE_DATE_EPOCH to set copyright year.
The build date of the software shouldn't really have any bearing on the copyright dates, but by respecting SOURCE_DATE_EPOCH, it at least limits this to the last time something in the source was changed. https://reproducible-builds.org/specs/source-date-epoch/
1 parent 0e16de7 commit 16ca8be

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

doc/conf.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@
2020
import sphinx
2121

2222
from datetime import datetime
23+
import time
24+
25+
# Parse year using SOURCE_DATE_EPOCH, falling back to current time.
26+
# https://reproducible-builds.org/specs/source-date-epoch/
27+
sourceyear=datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))).year
2328

2429
# If your extensions are in another directory, add it here. If the directory
2530
# is relative to the documentation root, use os.path.abspath to make it
@@ -212,7 +217,7 @@ def _check_dependencies():
212217
project = 'Matplotlib'
213218
copyright = ('2002 - 2012 John Hunter, Darren Dale, Eric Firing, '
214219
'Michael Droettboom and the Matplotlib development '
215-
f'team; 2012 - {datetime.now().year} The Matplotlib development team')
220+
f'team; 2012 - {sourceyear} The Matplotlib development team')
216221

217222

218223
# The default replacements for |version| and |release|, also used in various

0 commit comments

Comments
 (0)
0