diff --git a/sphinx/builders/gettext.py b/sphinx/builders/gettext.py index 1a30dd0fc..1c4789392 100644 --- a/sphinx/builders/gettext.py +++ b/sphinx/builders/gettext.py @@ -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) diff --git a/sphinx/config.py b/sphinx/config.py index 5ce807f7a..9cbf655f8 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -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: