Add pointers to the SOURCE_DATE_EPOCH specification.

This commit is contained in:
Alexis Bienvenüe 2016-05-03 09:53:54 +02:00
parent d978f93954
commit 0f33e6cb64
2 changed files with 4 additions and 1 deletions

View File

@ -130,6 +130,8 @@ class I18nBuilder(Builder):
timestamp = time()
tzdelta = datetime.fromtimestamp(timestamp) - \
datetime.utcfromtimestamp(timestamp)
# set timestamp from SOURCE_DATE_EPOCH if set
# see https://reproducible-builds.org/specs/source-date-epoch/
source_date_epoch = getenv('SOURCE_DATE_EPOCH')
if source_date_epoch is not None:
timestamp = float(source_date_epoch)

View File

@ -301,7 +301,8 @@ class Config(object):
self.extensions = config.get('extensions', [])
# correct values of copyright year that are not coherent with
# the SOURCE_DATE_EPOCH environment variable:
# the SOURCE_DATE_EPOCH environment variable (if set)
# See https://reproducible-builds.org/specs/source-date-epoch/
if getenv('SOURCE_DATE_EPOCH') is not None:
for k in ('copyright', 'epub_copyright'):
if k in config: