Closes #1159: do not emit duplicate inventory entries for py:module objects.

Also add a workaround on the consumer side in intersphinx, so that links
to projects using old versions of Sphinx generate correct links.
This commit is contained in:
Georg Brandl 2013-09-16 07:54:12 +02:00
parent a58c1332ff
commit ff33545457
2 changed files with 8 additions and 1 deletions

View File

@ -706,4 +706,5 @@ class PythonDomain(Domain):
for modname, info in self.data['modules'].iteritems():
yield (modname, modname, 'module', info[0], 'module-' + modname, 0)
for refname, (docname, type) in self.data['objects'].iteritems():
yield (refname, refname, type, docname, refname, 1)
if type != 'module': # modules are already handled
yield (refname, refname, type, docname, refname, 1)

View File

@ -106,6 +106,12 @@ def read_inventory_v2(f, uri, join, bufsize=16*1024):
if not m:
continue
name, type, prio, location, dispname = m.groups()
if type == 'py:module' and type in invdata and \
name in invdata[type]: # due to a bug in 1.1 and below,
# two inventory entries are created
# for Python modules, and the first
# one is correct
continue
if location.endswith(u'$'):
location = location[:-1] + name
location = join(uri, location)