Bug 849744 - ftbfs caused by python-docutils update
ftbfs caused by python-docutils update
Product: Fedora
Classification: Fedora
Component: python-docutils (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Toshio Ernie Kuratomi
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2012-08-20 14:15 EDT by Mads Kiilerich
Modified: 2012-09-17 18:59 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2012-09-17 18:59:28 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Mads Kiilerich 2012-08-20 14:15:35 EDT
Mercurial fails to build with python-docutils-0.10-0.2.20120730svn7490.fc18.noarch :

make -C doc
make[1]: Entering directory `/home/dev/rpmbuild/BUILD/mercurial-2.2.3/doc'
python runrst hgmanpage  --halt warning \
  --strip-elements-with-class htmlonly hgrc.5.txt hgrc.5
Traceback (most recent call last):
  File "runrst", line 50, in <module>
  File "/usr/lib/python2.7/site-packages/docutils/core.py", line 349, in publish_cmdline
    pub.set_components(reader_name, parser_name, writer_name)
  File "/usr/lib/python2.7/site-packages/docutils/core.py", line 99, in set_components
  File "/usr/lib/python2.7/site-packages/docutils/core.py", line 88, in set_writer
    writer_class = writers.get_writer_class(writer_name)
  File "/usr/lib/python2.7/site-packages/docutils/writers/__init__.py", line 136, in get_writer_class
    module = __import__(writer_name, globals(), locals(), level=1)
ImportError: No module named hgmanpage

It builds without problems when downgrading to python-docutils-0.8.1-3.fc17.noarch .
Comment 1 Toshio Ernie Kuratomi 2012-08-20 14:45:33 EDT
First look seems like a change in behaviour in docutils that would need a change in mercurial.  the hgmanpage module is located in mercurial's doc directory.  I bet that docutils used to somehow pick up on its presence there but now we need to set the PYTHONPATH or something to find it.
Comment 2 Toshio Ernie Kuratomi 2012-08-20 14:48:14 EDT
I notice that the master branch in git has mercurial-2.3.  Is it fine to look at that one?  (The issue is still occurring there and if I fix it there it'll be generalizable back to 2.2.3?)
Comment 3 Mads Kiilerich 2012-08-20 15:04:43 EDT
(In reply to comment #1)
> I bet that docutils used to somehow pick up on its presence
> there but now we need to set the PYTHONPATH or something to find it.

Hacking docutils so prints sys.path before the import shows that the doc folder is in the import path.

An explicit 'import hgmanpage' works. __import__ with level=-1 also works (for this import but fails for other imports).

(In reply to comment #2)

I don't think anything relevant changed in Mercurial, but testing with the version that worked in f17 takes one variable out of the equation.

I would expect that the docutils library was stable and didn't require changes in the code that use docutils. Using an unreleased svn snapshot will of course increase the risk of introducing a regression ... but also make it possible to fix it before the real release.
Comment 4 Toshio Ernie Kuratomi 2012-08-20 15:14:23 EDT
Here's the change in docutils that's causing this:


and the referenced bug report:


Unfortunately, docutils doesn't guarantee a stable API between releases.

I'm going to open this issue on the upstream bug tracker to see if it's intended behaviour or if they'd be willing to work out a different fix but I think this might be an intended change in behaviour as it brings the python2 and python3 behaviour in line with each other.
Comment 5 Toshio Ernie Kuratomi 2012-08-20 15:15:58 EDT
Note that Fedora 18 is going to ship with python3-3.3 so we'll have to pick up some change along these lines from upstream to support that python3 version.
Comment 6 Mads Kiilerich 2012-08-20 15:26:15 EDT
I thought the idea of py3 was to introduce non-backward compatible changes that couldn't be introduced in py2. 

If level=1 is needed for py3.3 then it should be used where it is necessary or do no harm. But to introduce a py2 regression when making it py3.3 compatible seems strange.
Comment 7 Toshio Ernie Kuratomi 2012-08-20 16:49:42 EDT
That's up to each individual upstream that's porting their library to python3.  python3 itself allowed the python upstream to introduce a large number of incompatible changes but that doesn't affect what individual libraries built on top of python do.

Testing the code a bit more, this isn't just a behaviour change, though.  The new code doesn't seem to have any way to load user-created writers (and probably readers and other things as well).  Fortunately, there's a simple fix for this if that is the case.
Comment 8 Toshio Ernie Kuratomi 2012-08-20 17:09:24 EDT

We're also waiting on dmalcolm or upstream to port this package to python3.3 before it will pass its own ftbfs.  I'll check with him to see if he has an update on that.
Comment 9 Fedora Update System 2012-08-24 13:59:53 EDT
python-docutils-0.10-0.5.20120824svn7502.fc18 has been submitted as an update for Fedora 18.
Comment 10 Toshio Ernie Kuratomi 2012-08-24 14:03:20 EDT
This should fix it for you.  On Rawhide, you should just be able to build.  On F18 you'll need to create a buildroot override in bodhi until the update goes to stable.  I'll probably make another package update later today because there's other places in the docutils code besides writers() that's affected by this change to __import__().  It shouldn't affect you unless you're also using a custom reader, parser, directives, or languages modules, though.

Let me know if there's any difficulties.
Comment 11 Fedora Update System 2012-08-24 17:34:03 EDT
Package python-docutils-0.10-0.5.20120824svn7502.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing python-docutils-0.10-0.5.20120824svn7502.fc18'
as soon as you are able to.
Please go to the following url:
then log in and leave karma (feedback).
Comment 12 Fedora Update System 2012-08-25 11:19:31 EDT
python-docutils-0.10-0.6.20120824svn7502.fc18 has been submitted as an update for Fedora 18.
Comment 13 Fedora Update System 2012-09-17 18:59:28 EDT
python-docutils-0.10-0.6.20120824svn7502.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.

Note You need to log in before you can comment on or make changes to this bug.