Use SOURCE_DATE_EPOCH in docs to make build reproducible
Set copyright year and html_last_updated_fmt to SOURCE_DATE_EPOCH if it's set. See https://reproducible-builds.org/specs/source-date-epoch/ This patch make build reproducible, see https://reproducible-builds.org/ Change-Id: I730a8265ca2c70c639ef77a613908e84eb738b70
This commit is contained in:
parent
2545372055
commit
a32fb30c16
@ -23,6 +23,7 @@
|
|||||||
# All configuration values have a default; values that are commented out
|
# All configuration values have a default; values that are commented out
|
||||||
# serve to show the default.
|
# serve to show the default.
|
||||||
|
|
||||||
|
import datetime
|
||||||
import os
|
import os
|
||||||
from swift import __version__
|
from swift import __version__
|
||||||
import subprocess
|
import subprocess
|
||||||
@ -154,6 +155,10 @@ pygments_style = 'sphinx'
|
|||||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||||
# using the given strftime format.
|
# using the given strftime format.
|
||||||
# html_last_updated_fmt = '%b %d, %Y'
|
# html_last_updated_fmt = '%b %d, %Y'
|
||||||
|
if 'SOURCE_DATE_EPOCH' in os.environ:
|
||||||
|
now = float(os.environ.get('SOURCE_DATE_EPOCH'))
|
||||||
|
html_last_updated_fmt = datetime.datetime.utcfromtimestamp(now).isoformat()
|
||||||
|
else:
|
||||||
git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local",
|
git_cmd = ["git", "log", "--pretty=format:'%ad, commit %h'", "--date=local",
|
||||||
"-n1"]
|
"-n1"]
|
||||||
try:
|
try:
|
||||||
@ -166,8 +171,6 @@ else:
|
|||||||
if not isinstance(html_last_updated_fmt, str):
|
if not isinstance(html_last_updated_fmt, str):
|
||||||
# for py3
|
# for py3
|
||||||
html_last_updated_fmt = html_last_updated_fmt.decode('ascii')
|
html_last_updated_fmt = html_last_updated_fmt.decode('ascii')
|
||||||
|
|
||||||
|
|
||||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||||
# typographically correct entities.
|
# typographically correct entities.
|
||||||
# html_use_smartypants = True
|
# html_use_smartypants = True
|
||||||
|
@ -72,7 +72,12 @@ master_doc = 'index'
|
|||||||
|
|
||||||
# General information about the project.
|
# General information about the project.
|
||||||
project = u'Swift'
|
project = u'Swift'
|
||||||
copyright = u'%d, OpenStack Foundation' % datetime.datetime.now().year
|
if 'SOURCE_DATE_EPOCH' in os.environ:
|
||||||
|
now = float(os.environ.get('SOURCE_DATE_EPOCH'))
|
||||||
|
now = datetime.datetime.utcfromtimestamp(now)
|
||||||
|
else:
|
||||||
|
now = datetime.date.today()
|
||||||
|
copyright = u'%d, OpenStack Foundation' % now.year
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user