Skip to content

Commit a933796

Browse files
smcvlamby
andauthored
Make the documentation reproducible when rebuilt (#652)
The Reproducible Builds project aims to arrange for rebuilding the same source code in a sufficiently similar environment to produce the same installable packages every time, as a way to discourage supply-chain attacks by making it possible to verify that a particular installable package was built from the claimed source code. Previously, if meson-python was built twice, at least a year apart, then its documentation would contain different copyright dates. The SOURCE_DATE_EPOCH environment variable is used here to avoid that difference: the intention is that environments that want to produce reproducible packages will set SOURCE_DATE_EPOCH to some suitable fixed date (perhaps the date of the most recent git commit) which is held constant across rebuilds. See the specification for SOURCE_DATE_EPOCH for more details: https://reproducible-builds.org/docs/source-date-epoch/ [smcv: Added commit message] Co-authored-by: Chris Lamb <[email protected]>
1 parent 9df4ffd commit a933796

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

docs/conf.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,21 @@
1616

1717
import datetime
1818
import os
19+
import time
1920
import sys
2021
sys.path.insert(0, os.path.abspath('..'))
2122
import mesonpy
2223

24+
build_date = datetime.datetime.fromtimestamp(
25+
int(os.environ.get('SOURCE_DATE_EPOCH', time.time())),
26+
tz=datetime.timezone.utc,
27+
)
28+
2329

2430
# -- Project information -----------------------------------------------------
2531

2632
project = 'meson-python'
27-
copyright = f'2021\N{EN DASH}{datetime.date.today().year} The meson-python developers'
33+
copyright = f'2021\N{EN DASH}{build_date.year} The meson-python developers'
2834

2935
# The short X.Y version
3036
version = mesonpy.__version__

0 commit comments

Comments
 (0)