Hi everyone. I'm attempting to document a fairly large python project of which a major component is an extensive C++ library we've wrapped with Boost.Python. I'm using autodoc and everything is working great - in fact I've written a simple Sphinx extension using the new autodoc events that cleans up the autodocumentation of Boost.Python generated modules. I did have to make some very minor changes to the autodoc extension to allow it to play nicely with Boost.Python things - I'll contribute those back to the project.
However, there is one remaining complication. We have a module, I'll call module A, that imports one of two different C++ libraries (wrapped with Boost.Python that we'll call B and C). B and C are identical, except they're compiled against a different version of Python, or with a different compiler, or whatever hypothetical you feel like using. Module A does some detection of the environment and then imports either B or C, hoisting all of the objects in B or C into A's namespace. Our users only ever import A and never need to know anything about B or C. When I generate documentation using autodoc, particularly the :show- inheritance: tag, it finds the correct parent classes, but the discovery process leads the builder to think they are defined in B or C (which they are). However, I've documented them as if they were defined in A (the way it appears to the users). Therefore, my links are broken because it can't resolve the reference. To fix this, I'm writing an event handler for the missing-reference event. The code for this is very simple - in fact it is essentially lines 1289-1312 in environment.py in Sphinx, except that I swap any occurrences of B or C in strings for A. The problem I'm running into, however, is that the code on those lines uses the 'fromdocname' variable twice, and I can't figure out how to get access to this value. I've resorted to adding a line to environment.py that does self.fromdocname = fromdocname so that I can access it, and then everything works wonderfully. This is a pretty terrible hack, however. Does anyone have any ideas for a better way to do this? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sphinx-dev" group. To post to this group, send email to sphinx-dev@googlegroups.com To unsubscribe from this group, send email to sphinx-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sphinx-dev?hl=en -~----------~----~----~----~------~----~------~--~---