1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
From: Vagrant Cascadian <vagrant@reproducible-builds.org> and Federico Ceratto <federico@debian.org>
Subject: Use SOURCE_DATE_EPOCH in setting doc build year
Forwarded: no
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -17,6 +17,7 @@
import os
import sys
+from time import time
from datetime import datetime
from sphinx.domains.python import PythonDomain
@@ -44,7 +45,8 @@
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
-year = datetime.now().year
+ts = int(os.environ.get('SOURCE_DATE_EPOCH', time()))
+year = datetime.utcfromtimestamp(ts).year
# 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
|