From e9fc8d890ce568d279e40da28f6b2f3d3f3ee75f Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Thu, 3 Sep 2009 18:00:11 +0200 Subject: [PATCH 1/7] Really fix the problem of keeping all pgen2 parser nodes in memory. --- sphinx/ext/autodoc.py | 5 +++-- sphinx/pycode/__init__.py | 2 ++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index ea9a8f17d..988a82e02 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -620,8 +620,9 @@ class Documenter(object): # try to also get a source code analyzer for attribute docs try: self.analyzer = ModuleAnalyzer.for_module(self.real_modname) - # parse right now, to get PycodeErrors on parsing - self.analyzer.parse() + # parse right now, to get PycodeErrors on parsing (results will + # be cached anyway) + self.analyzer.find_attr_docs() except PycodeError, err: # no source file -- e.g. for builtin and C modules self.analyzer = None diff --git a/sphinx/pycode/__init__.py b/sphinx/pycode/__init__.py index 1187b6a43..fa8d0e948 100644 --- a/sphinx/pycode/__init__.py +++ b/sphinx/pycode/__init__.py @@ -234,6 +234,8 @@ class ModuleAnalyzer(object): attr_visitor = AttrDocVisitor(number2name, scope, self.encoding) attr_visitor.visit(self.parsetree) self.attr_docs = attr_visitor.collected + # now that we found everything we could in the tree, throw it away + # (it takes quite a bit of memory for large modules) self.parsetree = None return attr_visitor.collected From eff2bdd5151573287e226b6d5ad75b133a738d91 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Thu, 3 Sep 2009 22:00:10 +0200 Subject: [PATCH 2/7] Properly add C module filenames as dependencies in autodoc. --- CHANGES | 2 ++ sphinx/ext/autodoc.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/CHANGES b/CHANGES index 59e44e404..473a99b4d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,8 @@ Release 0.6.3 (in development) ============================== +* Properly add C module filenames as dependencies in autodoc. + * #253: Ignore graphviz directives without content instead of raising an unhandled exception. diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 155c5711a..ea9a8f17d 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -625,6 +625,9 @@ class Documenter(object): except PycodeError, err: # no source file -- e.g. for builtin and C modules self.analyzer = None + # at least add the module.__file__ as a dependency + if hasattr(self.module, '__file__') and self.module.__file__: + self.directive.filename_set.add(self.module.__file__) else: self.directive.filename_set.add(self.analyzer.srcname) From cad559806923eed0e3c81385272c94082345a5a9 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Thu, 3 Sep 2009 23:20:26 +0200 Subject: [PATCH 3/7] fix typos. --- sphinx/util/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index 72b2a9c89..50c5bd3f7 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -443,7 +443,7 @@ def split_explicit_title(text): """Split role content into title and target, if given.""" match = explicit_title_re.match(text) if match: - return True, m.group(1), m.group(2) + return True, match.group(1), match.group(2) return False, text, text # monkey-patch Node.traverse to get more speed From dcff10ddaa6553c633db886b2aa9a43bf402749b Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 4 Sep 2009 00:05:09 +0200 Subject: [PATCH 4/7] Cleanup unused imports. --- sphinx/application.py | 2 +- sphinx/builders/changes.py | 1 - sphinx/environment.py | 5 ----- sphinx/ext/autodoc.py | 3 +-- sphinx/ext/graphviz.py | 2 -- sphinx/ext/inheritance_diagram.py | 2 -- sphinx/jinja2glue.py | 1 - sphinx/search.py | 1 - 8 files changed, 2 insertions(+), 15 deletions(-) diff --git a/sphinx/application.py b/sphinx/application.py index 972c427c0..b4280892f 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -26,7 +26,7 @@ from sphinx.errors import SphinxError, SphinxWarning, ExtensionError from sphinx.builders import BUILTIN_BUILDERS from sphinx.directives import GenericDesc, Target, additional_xref_types from sphinx.environment import SphinxStandaloneReader -from sphinx.util import pycompat +from sphinx.util import pycompat # imported for side-effects from sphinx.util.tags import Tags from sphinx.util.compat import Directive, directive_dwim from sphinx.util.console import bold diff --git a/sphinx/builders/changes.py b/sphinx/builders/changes.py index e07b06d88..d9898aebe 100644 --- a/sphinx/builders/changes.py +++ b/sphinx/builders/changes.py @@ -10,7 +10,6 @@ """ import codecs -import shutil from os import path from cgi import escape diff --git a/sphinx/environment.py b/sphinx/environment.py index 4319b1c01..d5e12eb1b 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -22,11 +22,6 @@ import cPickle as pickle from os import path from glob import glob from itertools import izip, groupby -try: - from hashlib import md5 -except ImportError: - # 2.4 compatibility - from md5 import md5 from docutils import nodes from docutils.io import FileInput, NullOutput diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 988a82e02..a5e90b6f4 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -14,8 +14,7 @@ import re import sys import inspect -from types import ModuleType, FunctionType, BuiltinFunctionType, MethodType, \ - ClassType +from types import FunctionType, BuiltinFunctionType, MethodType, ClassType from docutils import nodes from docutils.utils import assemble_option_dict diff --git a/sphinx/ext/graphviz.py b/sphinx/ext/graphviz.py index 1b6a03eef..449d9524a 100644 --- a/sphinx/ext/graphviz.py +++ b/sphinx/ext/graphviz.py @@ -10,9 +10,7 @@ :license: BSD, see LICENSE for details. """ -import os import re -import sys import posixpath from os import path from subprocess import Popen, PIPE diff --git a/sphinx/ext/inheritance_diagram.py b/sphinx/ext/inheritance_diagram.py index 9c037c998..357907310 100644 --- a/sphinx/ext/inheritance_diagram.py +++ b/sphinx/ext/inheritance_diagram.py @@ -36,11 +36,9 @@ :license: BSD, see LICENSE for details. """ -import os import re import sys import inspect -import subprocess try: from hashlib import md5 except ImportError: diff --git a/sphinx/jinja2glue.py b/sphinx/jinja2glue.py index c584a0cde..91f7c101f 100644 --- a/sphinx/jinja2glue.py +++ b/sphinx/jinja2glue.py @@ -9,7 +9,6 @@ :license: BSD, see LICENSE for details. """ -import codecs from os import path from pprint import pformat diff --git a/sphinx/search.py b/sphinx/search.py index f6e3ef3f9..9ca0682fa 100644 --- a/sphinx/search.py +++ b/sphinx/search.py @@ -10,7 +10,6 @@ """ import re import cPickle as pickle -from cStringIO import StringIO from docutils.nodes import comment, Text, NodeVisitor, SkipNode From aea14370d90ff203080f3b442fa50fa405b589b9 Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 4 Sep 2009 00:06:12 +0200 Subject: [PATCH 5/7] Prepare for 0.6.3 release --- CHANGES | 4 ++-- sphinx/__init__.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 473a99b4d..3a8e8bf89 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,5 @@ -Release 0.6.3 (in development) -============================== +Release 0.6.3 (Sep 03, 2009) +============================ * Properly add C module filenames as dependencies in autodoc. diff --git a/sphinx/__init__.py b/sphinx/__init__.py index 17b37823d..bebfa70bf 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -12,8 +12,8 @@ import sys from os import path -__version__ = '0.6.2+' -__released__ = '0.6.2' # used when Sphinx builds its own docs +__version__ = '0.6.3' +__released__ = '0.6.3' # used when Sphinx builds its own docs package_dir = path.abspath(path.dirname(__file__)) From 0899e017a9a0963408c6cff8c3c19a20d3efbcaa Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Fri, 4 Sep 2009 00:14:18 +0200 Subject: [PATCH 7/7] Post-0.6.3 changes. --- CHANGES | 4 ++++ sphinx/__init__.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 3a8e8bf89..cf7afdb33 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,7 @@ +Release 0.6.4 (in development) +============================== + + Release 0.6.3 (Sep 03, 2009) ============================ diff --git a/sphinx/__init__.py b/sphinx/__init__.py index bebfa70bf..5b5980ed3 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -12,7 +12,7 @@ import sys from os import path -__version__ = '0.6.3' +__version__ = '0.6.3+' __released__ = '0.6.3' # used when Sphinx builds its own docs package_dir = path.abspath(path.dirname(__file__))