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