Skip to content

Commit 38cff45

Browse files
committed
Switch to Sphinx's InventoryFile when retrieving URLs
The interface to fetch_inventory changed around the 7-8 major version to take a Sphinx config object. However, we're not working with a sphinx site and just want it to load and parse an inventory file for us. Luckily, the project ships the InventoryFile class which provides an interface to do exactly this.
1 parent 48b7fbf commit 38cff45

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cbv/management/commands/fetch_docs_urls.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
import posixpath
2+
13
import requests
24
from blessings import Terminal
35
from django.conf import settings
46
from django.core.management.base import BaseCommand
5-
from sphinx.ext.intersphinx import fetch_inventory
7+
from sphinx.util.inventory import InventoryFile
68

79
from cbv.models import Klass, ProjectVersion
810

@@ -51,7 +53,7 @@ def handle(self, *args, **options):
5153
# the arg `r.raw` should be a Sphinx instance object..
5254
r = requests.get(ver_inv_url, stream=True)
5355
r.raise_for_status()
54-
invdata = fetch_inventory(r.raw, ver_url, ver_inv_url)
56+
invdata = InventoryFile.load(r.raw, ver_url, posixpath.join)
5557
# we only want classes..
5658
for item in invdata["py:class"]:
5759
# ..which come from one of our sources

0 commit comments

Comments
 (0)