-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Extend SOURCE_DATE_EPOCH support #2503
Conversation
# correct values of copyright year that are not coherent with | ||
# the SOURCE_DATE_EPOCH environment variable: | ||
if getenv('SOURCE_DATE_EPOCH') is not None: | ||
for k in ['copyright','epub_copyright']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor nit: you can use tuple instead of a list here.
* use tuple instead of list * compile regex to find copyright year * enclose test inside try/finally
PEP-8-ifying the files won't hurt, but in general looks fine. 👍 Oh, and maybe you can include a link to https://reproducible-builds.org/specs/source-date-epoch/ in the comments somewhere? |
@mitya57 : oh yes, that was missing! |
LGTM! I will merge this within a day if no objection :-) |
Thanks for your support! |
Merged! |
The SOURCE_DATE_EPOCH support is very important for reproducible builds of packages that use sphinx for their documentation.
copyright = u'2006-%s, Author' % time.strftime('%Y')
This breaks reproducibility, with an artificial copyright date related to build time instead of source date. I suggest to use SOURCE_DATE_EPOCH (when set) to correct these dates automatically.
sphinx/util/i18n.py
, thedate = gmtime(float(source_date_epoch))
definition leads to an error when passed tobabel.dates.format_date
, that needs adate
ordatetime
object (maybe my setup? I use babel 1.3), so I replaced it with an equivalentdatetime
call.