From: =?utf-8?q?Alexis_Bienven=C3=BCe?= Date: Sat, 2 Apr 2016 03:05:43 +0000 Subject: Honour SOURCE_DATE_EPOCH for copyright year Uses SOURCE_DATE_EPOCH environment variable (if set) to set the copyright year in documentation, to get reproducible build. --- docs/conf.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/conf.py b/docs/conf.py index 3090cc9..ec3f6eb 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -15,7 +15,10 @@ import sys, os, os.path, re import itertools import datetime -YEAR = datetime.date.today().strftime('%Y') +if os.environ['SOURCE_DATE_EPOCH']: + YEAR = datetime.datetime.utcfromtimestamp(float(os.environ.get('SOURCE_DATE_EPOCH'))).strftime('%Y') +else: + YEAR = datetime.date.today().strftime('%Y') # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the