Bug 209878 - textproc/py-sphinx: triggers AssertionError from py-Babel when SOURCE_DATE_EPOCH environment variable is set
Summary: textproc/py-sphinx: triggers AssertionError from py-Babel when SOURCE_DATE_EP...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Kris Moore
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-31 00:42 UTC by Ed Maste
Modified: 2016-06-21 16:58 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (kmoore)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer 2016-05-31 00:42:40 UTC
Setting SOURCE_DATE_EPOCH to a specific timestamp (for reproducible builds) triggers an assertion failure from py-Babel, like so (py27-pip-8.0.2.log):

preparing documents... Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "setup.py", line 88, in <module>
    cmdclass={'test': PyTest},
  File "/usr/local/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/usr/local/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python2.7/site-packages/sphinx/setup_command.py", line 164, in run
    app.build(force_all=self.all_files)
  File "/usr/local/lib/python2.7/site-packages/sphinx/application.py", line 281, in build
    self.builder.build_all()
  File "/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 211, in build_all
    self.build(None, summary='all source files', method='all')
  File "/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 322, in build
    self.write(docnames, list(updated_docnames), method)
  File "/usr/local/lib/python2.7/site-packages/sphinx/builders/__init__.py", line 349, in write
    self.prepare_writing(docnames)
  File "/usr/local/lib/python2.7/site-packages/sphinx/builders/html.py", line 297, in prepare_writing
    warn=self.warn)
  File "/usr/local/lib/python2.7/site-packages/sphinx/util/i18n.py", line 221, in format_date
    formatter=function))
  File "/usr/local/lib/python2.7/site-packages/sphinx/util/i18n.py", line 170, in babel_format_date
    return formatter(date, format, locale=locale)
  File "/usr/local/lib/python2.7/site-packages/babel/dates.py", line 686, in format_date
    return pattern.apply(date, locale)
  File "/usr/local/lib/python2.7/site-packages/babel/dates.py", line 1208, in apply
    return self % DateTimeFormat(datetime, locale)
  File "/usr/local/lib/python2.7/site-packages/babel/dates.py", line 1214, in __init__
    assert isinstance(value, (date, datetime, time))
AssertionError
*** Error code 1

This is because sphinx/util/i18n.py has:
            date = gmtime(float(source_date_epoch))
while babel expects a datetime

Fixed upstream here: https://github.com/sphinx-doc/sphinx/commit/7a89015a5466412597b9a0157c0ab1af1914a81a
Comment 1 Ed Maste freebsd_committer 2016-05-31 01:50:44 UTC
I'm continuing my testing with just the i18n.py change extracted from the upstream commit, as here: https://github.com/emaste/freebsd-ports/commit/faecb690882d421dd4bd11cd960926ab63918696
Comment 2 Ed Maste freebsd_committer 2016-06-13 21:07:36 UTC
This will be fixed by updating to a new version of py-sphinx, but if that's not going to happen soon the patch file in my github commit referenced in comment 1 allowed my test poudriere runs (for my talk) to complete.
Comment 3 commit-hook freebsd_committer 2016-06-21 16:56:16 UTC
A commit references this bug:

Author: kmoore
Date: Tue Jun 21 16:55:53 UTC 2016
New revision: 417278
URL: https://svnweb.freebsd.org/changeset/ports/417278

Log:
  - Update to 1.4.4

  PR: 209878

Changes:
  head/textproc/py-sphinx/Makefile
  head/textproc/py-sphinx/distinfo
Comment 4 Kris Moore freebsd_committer 2016-06-21 16:57:38 UTC
Updated to 1.4.4 which hopefully fixes this for you. Thanks!
Comment 5 Ed Maste freebsd_committer 2016-06-21 16:58:41 UTC
> Updated to 1.4.4 which hopefully fixes this for you. Thanks!

Thank you. I will submit another PR if there's a new issue.