bitprophet / releases

A powerful Sphinx changelog-generating extension.
http://releases.readthedocs.io/
BSD 2-Clause "Simplified" License
176 stars 41 forks source link

Fix util module for Sphinx 1.8+ #91

Closed bitprophet closed 1 year ago

bitprophet commented 4 years ago

After #87 I found that Releases itself still works OK, but our util module (used by invocations' release package to parse Releases changelogs as a way of ensuring one has updated one's changelog) broke - it does things the main part of Releases doesn't need to, basically trying to fake Sphinx into rendering a project in-memory instead of on-disk.

Took a brief stab at it in https://github.com/bitprophet/releases/tree/sphinx-1.8-plus-broke-utils but once I fix outright explosions, I still end up with a rendered doctree which is missing our custom objects (though things like :ref: still work, re: the final block of util.get_doctree's comment about it being necessary). They're just the default 'raw' objects instead.


For the time being I am updating the test suite / Travis config to ignore the utils module as it's not technically required for Releases to function (I'm almost certainly the only user of utils).

My suspicion is that the simplest way forward here is to stop worrying about any Sphinx <1.8 (maybe even <2), just try to get this working again (even if it means starting over from scratch), and release the fix as Releases 1.7 which changes the Sphinx pin again to be >=1.8/2.0.

Rationale for that last, besides salvaging the remaining shreds of my sanity, is that if even conservative ol' me is having issues trying to run Sphinx <1.8 in today's ecosystem, very few other users are going to be caring about those versions. Better to cut the chaff and, if necessary, merge patches from folks to support Releases <=1.6.x on the older Sphinxes if critical bugs pop up.

bitprophet commented 4 years ago

After a day of fuckery, I solved it: Sphinx 1.8 moved the read-doctree event much earlier in the build process, which was causing the doctree to already have the HTML nodes expanded/rendered by the time I got the doctree in-hand.

They did document this in their changelog, but I didn't even realize that this was the problem until very late (figured something else had changed deep in the guts instead) so it's not like I would have known to look for it. Bit annoying it changed before 2.0 (or I would have maybe expected it more), but hopefully it means this is the main org change between here and 2.x... 😒

bitprophet commented 4 years ago

Fix tested on Python 2 (Sphinx 1.8.x) and Python 3 (Sphinx 1.8.x and latest Sphinx 2.x). Seeeems good.

Left:

bitprophet commented 1 year ago

This ought to be all fixed up as of latest major release.