From 87a7881d46b7a552f1310ca0fb994529d9121fc4 Mon Sep 17 00:00:00 2001 From: Larry Doolittle Date: Mon, 30 Jan 2023 19:14:33 -0800 Subject: [PATCH] Add SOURCE_DATE_EPOCH for docs/guide/conf.py (#3918) --- docs/guide/conf.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/guide/conf.py b/docs/guide/conf.py index bcf574cc7..04759c6de 100644 --- a/docs/guide/conf.py +++ b/docs/guide/conf.py @@ -89,8 +89,14 @@ source_suffix = [".rst"] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] +try: + # https://reproducible-builds.org/specs/source-date-epoch/ + doc_now = datetime.fromtimestamp(int(os.environ["SOURCE_DATE_EPOCH"])) + print("Using SOURCE_DATE_EPOCH") +except Exception: + doc_now = datetime.now() # Date format to ISO -today_fmt = datetime.now().strftime("%F") +today_fmt = doc_now.strftime("%F") # If true, `todo` and `todoList` produce output, else they produce nothing. todo_include_todos = True