mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merged in bsipocz/sphinx (pull request #275)
Adding the option of multiple inv for the same name & uri
This commit is contained in:
commit
aa744dda97
@ -102,6 +102,18 @@ linking:
|
|||||||
``http://docs.python.org/3.2``. It is up to you to update the inventory file
|
``http://docs.python.org/3.2``. It is up to you to update the inventory file
|
||||||
as new objects are added to the Python documentation.
|
as new objects are added to the Python documentation.
|
||||||
|
|
||||||
|
.. versionadded:: 1.3
|
||||||
|
|
||||||
|
Alternative files can be specified for each inventory. One can give a
|
||||||
|
tuple for the second inventory tuple item as shown in the following
|
||||||
|
example. This will read the inventory iterating through the (second)
|
||||||
|
tuple items until the first successful fetch. The primary use case for
|
||||||
|
this to specify mirror sites for server downtime of the primary
|
||||||
|
inventory::
|
||||||
|
|
||||||
|
intersphinx_mapping = {'python': ('http://docs.python.org/3.2',
|
||||||
|
(None, 'python-inv.txt'))}
|
||||||
|
|
||||||
.. confval:: intersphinx_cache_limit
|
.. confval:: intersphinx_cache_limit
|
||||||
|
|
||||||
The maximum number of days to cache remote inventories. The default is
|
The maximum number of days to cache remote inventories. The default is
|
||||||
|
@ -179,19 +179,25 @@ def load_mappings(app):
|
|||||||
# we can safely assume that the uri<->inv mapping is not changed
|
# we can safely assume that the uri<->inv mapping is not changed
|
||||||
# during partial rebuilds since a changed intersphinx_mapping
|
# during partial rebuilds since a changed intersphinx_mapping
|
||||||
# setting will cause a full environment reread
|
# setting will cause a full environment reread
|
||||||
if not inv:
|
if not isinstance(inv, tuple):
|
||||||
inv = posixpath.join(uri, INVENTORY_FILENAME)
|
invs = (inv, )
|
||||||
# decide whether the inventory must be read: always read local
|
else:
|
||||||
# files; remote ones only if the cache time is expired
|
invs = inv
|
||||||
if '://' not in inv or uri not in cache \
|
|
||||||
or cache[uri][1] < cache_time:
|
for inv in invs:
|
||||||
app.info('loading intersphinx inventory from %s...' % inv)
|
if not inv:
|
||||||
invdata = fetch_inventory(app, uri, inv)
|
inv = posixpath.join(uri, INVENTORY_FILENAME)
|
||||||
if invdata:
|
# decide whether the inventory must be read: always read local
|
||||||
cache[uri] = (name, now, invdata)
|
# files; remote ones only if the cache time is expired
|
||||||
else:
|
if '://' not in inv or uri not in cache \
|
||||||
cache.pop(uri, None)
|
or cache[uri][1] < cache_time:
|
||||||
update = True
|
app.info('loading intersphinx inventory from %s...' % inv)
|
||||||
|
invdata = fetch_inventory(app, uri, inv)
|
||||||
|
if invdata:
|
||||||
|
cache[uri] = (name, now, invdata)
|
||||||
|
update = True
|
||||||
|
break
|
||||||
|
|
||||||
if update:
|
if update:
|
||||||
env.intersphinx_inventory = {}
|
env.intersphinx_inventory = {}
|
||||||
env.intersphinx_named_inventory = {}
|
env.intersphinx_named_inventory = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user