Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SOURCE_DATE_EPOCH environment variable for "reproducible" builds. #939

Merged
merged 1 commit into from May 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Support SOURCE_DATE_EPOCH environment variable for "reproducible" bui…
…lds.

Fixes #938.
  • Loading branch information
waylan committed May 16, 2016
commit 8b006bd7fda55e47e29412896c511c7244398f82
2 changes: 2 additions & 0 deletions docs/about/release-notes.md
Expand Up @@ -73,6 +73,8 @@ created and third-party templates:
pages config. (#728)
* Update searching to Lunr 0.7, which comes with some performance enhancements
for larger documents (#859)
* Bugfix: Support SOURCE_DATE_EPOCH environment variable for "reproducible"
builds (#938)

## Version 0.15.3 (2016-02-18)

Expand Down
7 changes: 6 additions & 1 deletion mkdocs/commands/build.py
Expand Up @@ -2,6 +2,7 @@

from __future__ import unicode_literals
from datetime import datetime
from calendar import timegm
import io
import logging
import os
Expand Down Expand Up @@ -56,6 +57,10 @@ def get_global_context(nav, config):

extra_css = utils.create_media_urls(nav, config['extra_css'])

# Support SOURCE_DATE_EPOCH environment variable for "reproducible" builds.
# See https://reproducible-builds.org/specs/source-date-epoch/
timestamp = int(os.environ.get('SOURCE_DATE_EPOCH', timegm(datetime.utcnow().utctimetuple())))

return {
'site_name': site_name,
'site_author': config['site_author'],
Expand Down Expand Up @@ -84,7 +89,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(timestamp),

'config': config
}
Expand Down