[Python-modules-commits] [python-mkdocs] 01/03: Support reproducible builds
Brian May
bam at moszumanska.debian.org
Thu Jul 28 22:11:59 UTC 2016
This is an automated email from the git hooks/post-receive script.
bam pushed a commit to branch master
in repository python-mkdocs.
commit f37eb5e81c996800e2e69180fa225dfef3943c84
Author: Brian May <bam at debian.org>
Date: Fri Jul 29 08:06:08 2016 +1000
Support reproducible builds
See https://github.com/mkdocs/mkdocs/issues/938
---
mkdocs/commands/build.py | 3 ++-
mkdocs/nav.py | 6 +++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/mkdocs/commands/build.py b/mkdocs/commands/build.py
index 614173d..66fef62 100644
--- a/mkdocs/commands/build.py
+++ b/mkdocs/commands/build.py
@@ -5,6 +5,7 @@ from datetime import datetime
import io
import logging
import os
+import time
from jinja2.exceptions import TemplateNotFound
import jinja2
@@ -83,7 +84,7 @@ def get_global_context(nav, config):
'google_analytics': config['google_analytics'],
'mkdocs_version': mkdocs.__version__,
- 'build_date_utc': datetime.utcnow(),
+ 'build_date_utc': datetime.utcfromtimestamp(int(os.environ.get('SOURCE_DATE_EPOCH', time.time()))),
'config': config
}
diff --git a/mkdocs/nav.py b/mkdocs/nav.py
index b72e21f..07f6505 100644
--- a/mkdocs/nav.py
+++ b/mkdocs/nav.py
@@ -137,7 +137,11 @@ class Page(object):
self.abs_url = url
self.active = False
self.url_context = url_context
- self.update_date = datetime.datetime.now().strftime("%Y-%m-%d")
+
+ try:
+ self.update_date = datetime.datetime.utcfromtimestamp(int(os.environ['SOURCE_DATE_EPOCH']))
+ except KeyError:
+ self.update_date = datetime.datetime.now().strftime("%Y-%m-%d")
# Relative paths to the input markdown file and output html file.
self.input_path = path
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-mkdocs.git
More information about the Python-modules-commits
mailing list