diff options
author | Georg Brandl <georg@python.org> | 2014-01-19 09:54:24 +0100 |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-01-19 09:54:24 +0100 |
commit | 600dedfc2f49e158d32c0acf20462b4df78a592f (patch) | |
tree | 16a75af03ae33c0630d62eecddf14660c08bf44a /sphinx/ext | |
parent | 27199d51c3c4af6ccba6e102b910f82e4519e417 (diff) | |
download | sphinx-600dedfc2f49e158d32c0acf20462b4df78a592f.tar.gz |
Closes #848: Always take the newest code in incremental rebuilds with the :mod:`sphinx.ext.viewcode` extension.
Diffstat (limited to 'sphinx/ext')
-rw-r--r-- | sphinx/ext/viewcode.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/sphinx/ext/viewcode.py b/sphinx/ext/viewcode.py index 962b543b..36fb47d2 100644 --- a/sphinx/ext/viewcode.py +++ b/sphinx/ext/viewcode.py @@ -24,17 +24,17 @@ def doctree_read(app, doctree): def has_tag(modname, fullname, docname): entry = env._viewcode_modules.get(modname, None) - if entry is None: - try: - analyzer = ModuleAnalyzer.for_module(modname) - except Exception: - env._viewcode_modules[modname] = False - return + try: + analyzer = ModuleAnalyzer.for_module(modname) + except Exception: + env._viewcode_modules[modname] = False + return + if not isinstance(analyzer.code, unicode): + code = analyzer.code.decode(analyzer.encoding) + else: + code = analyzer.code + if entry is None or entry[0] != code: analyzer.find_tags() - if not isinstance(analyzer.code, unicode): - code = analyzer.code.decode(analyzer.encoding) - else: - code = analyzer.code entry = code, analyzer.tags, {} env._viewcode_modules[modname] = entry elif entry is False: @@ -142,7 +142,7 @@ def collect_pages(app): if not modnames: return - app.builder.info(' _modules/index') + app.builder.info(' _modules/index', nonl=True) html = ['\n'] # the stack logic is needed for using nested lists for submodules stack = [''] |