From b4132cbaa0ea2238be6d2900912762acebef9a87 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 19 May 2016 14:57:07 -0700 Subject: [PATCH] If we're processing a real[*] module grab and save the etg docstring. [*] A "real" module is defined by the etg scripts which include others, like wx._core, wx._adv, etc. These are the ones turned into the actual extension modules in the final parts of the build. --- etgtools/extractors.py | 1 + etgtools/sphinx_generator.py | 9 ++++++++- sphinxtools/constants.py | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/etgtools/extractors.py b/etgtools/extractors.py index eb2d1b01..d9400a96 100644 --- a/etgtools/extractors.py +++ b/etgtools/extractors.py @@ -1311,6 +1311,7 @@ class ModuleDef(BaseDef): self.postInitializerCode = [] self.includes = [] self.imports = [] + self.isARealModule = (module == name) def parseCompleted(self): diff --git a/etgtools/sphinx_generator.py b/etgtools/sphinx_generator.py index bba9a381..9eb6eb60 100644 --- a/etgtools/sphinx_generator.py +++ b/etgtools/sphinx_generator.py @@ -52,12 +52,14 @@ from sphinxtools.utilities import ChopDescription, PythonizeType, Wx2Sphinx from sphinxtools.utilities import PickleClassInfo, IsNumeric from sphinxtools.utilities import Underscore2Capitals, CountSpaces from sphinxtools.utilities import FormatContributedSnippets +from sphinxtools.utilities import PickleFile from sphinxtools.constants import VERSION, REMOVED_LINKS, SECTIONS from sphinxtools.constants import MAGIC_METHODS, MODULENAME_REPLACE from sphinxtools.constants import IGNORE, NO_MODULE from sphinxtools.constants import SPHINXROOT, DOXYROOT from sphinxtools.constants import SNIPPETROOT, TABLEROOT, OVERVIEW_IMAGES_ROOT +from sphinxtools.constants import DOCSTRING_KEY # ----------------------------------------------------------------------- # @@ -2961,7 +2963,12 @@ class SphinxGenerator(generators.DocsGeneratorBase): extractors.PyFunctionDef : self.generatePyFunction, extractors.PyClassDef : self.generatePyClass, } - + + if module.isARealModule: + filename = os.path.join(SPHINXROOT, self.current_module+'1classindex.pkl') + with PickleFile(filename) as pf: + pf.items[DOCSTRING_KEY] = module.docstring + for item in module: if item.ignored: continue diff --git a/sphinxtools/constants.py b/sphinxtools/constants.py index 02a02ea1..9afef81a 100644 --- a/sphinxtools/constants.py +++ b/sphinxtools/constants.py @@ -82,7 +82,7 @@ MODULENAME_REPLACE = {'_core' : 'wx.', '_richtext': 'wx.richtext.', '_webkit' : 'wx.webkit.', '_media' : 'wx.media.', - '_msw' : 'wx.msw', + '_msw' : 'wx.msw.', } NO_MODULE = { @@ -189,6 +189,7 @@ WIDGETS_IMAGES_ROOT = os.path.join(SPHINXROOT, '_static', 'images', 'widgets', # Folder for the icons used for titles, sub-titles and so on for the Sphinx documentation SPHINX_IMAGES_ROOT = os.path.join(SPHINXROOT, '_static', 'images', 'sphinxdocs') +DOCSTRING_KEY = '__module_docstring' # The Doxygen root for the XML docstrings xmlsrcbase = 'docs/doxygen/out/xml'