Skip to content

Commit e9c6463

Browse files
authored
Merge pull request #25 from lamby/1005826-mpl-sphinx-theme-please-make-the-build-reproducible
Make the documentation build reproducibly
2 parents 81fd66a + 5467339 commit e9c6463

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

docs/conf.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
import time
13
import datetime
24

35
# Configuration file for the Sphinx documentation builder for
@@ -6,11 +8,17 @@
68
# Release mode enables optimizations and other related options.
79
is_release_build = tags.has('release') # noqa
810

11+
# Parse year using SOURCE_DATE_EPOCH, falling back to current time.
12+
# https://reproducible-builds.org/specs/source-date-epoch/
13+
build_date = datetime.datetime.utcfromtimestamp(
14+
int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))
15+
)
16+
917
# -- Project information -----------------------------------------------------
1018

1119
project = "Matplotlib Sphinx Theme"
1220
copyright = (
13-
f"2012 - {datetime.datetime.now().year} The Matplotlib development team"
21+
f"2012 - {build_date.year} The Matplotlib development team"
1422
)
1523
author = "Matplotlib Developers"
1624

0 commit comments

Comments
 (0)