Package: cython / 3.0.11+dfsg-2

honour_SOURCE_DATE_EPOCH_for_copyright_year Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From: =?utf-8?q?Alexis_Bienven=C3=BCe?= <pado@passoire.fr>
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 64dab73..532f835 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