From 6471b719cc4143d41232031ceedf8e03d5c1b447 Mon Sep 17 00:00:00 2001 From: Chris Lamb Date: Wed, 26 Jan 2022 08:18:18 -0800 Subject: [PATCH] Make the build reproducible Whilst working on the Reproducible Builds effort [0] I noticed that fluids could not be built reproducibly. This is due to the documentation automatically including the current year in a copyright footer, which means that the build will change depending on when you build. This patch uses SOURCE_DATE_EPOCH [1] to make this "build date" configurable/pluggable. I originally filed this in Debian as bug #1004391 [2]. [0] https://reproducible-builds.org/ [1] https://reproducible-builds.org/specs/source-date-epoch/ [2] https://bugs.debian.org/1004391 --- docs/conf.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index d3de9644..a3226ff1 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -77,8 +77,13 @@ # General information about the project. project = u'Fluids' +import os +import time import datetime -copyright = u'2016 - %s, Caleb Bell ' %datetime.datetime.now().year +build_date = datetime.datetime.utcfromtimestamp( + int(os.environ.get('SOURCE_DATE_EPOCH', time.time())) +) +copyright = u'2016 - %s, Caleb Bell ' % build_date.year # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the