File tree Expand file tree Collapse file tree
src/crate/theme/vendor/rtd_compat Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import os
2+ import sys
23
34from sphinx import version_info
45from sphinx .util import logging
@@ -61,21 +62,25 @@ def manipulate_config(app, config):
6162 language = "en"
6263
6364 # Project versions. Acquire them from RTD's API.
64- try :
65- response_versions = requests .get (
66- f"{ scheme } ://{ production_domain } /api/v3/projects/{ project_slug } /versions/?active=true" ,
67- timeout = 2 ,
68- ).json ()
69- versions = [
70- (version ["slug" ], f"/{ language } /{ version ['slug' ]} /" )
71- for version in response_versions ["results" ]
72- ]
73- except Exception :
74- logger .warning (
75- "An error ocurred when hitting API to fetch active versions. Defaulting to an empty list." ,
76- exc_info = True ,
77- )
78- versions = []
65+ # Note this skips acquiring project versions when running the link checker.
66+ # This avoids hammering the RTD API when rebuilding _all_ docs.
67+ versions = []
68+ if "linkcheck" not in sys .argv :
69+ try :
70+ response_versions = requests .get (
71+ f"{ scheme } ://{ production_domain } /api/v3/projects/{ project_slug } /versions/?active=true" ,
72+ timeout = 2 ,
73+ ).json ()
74+ versions = [
75+ (version ["slug" ], f"/{ language } /{ version ['slug' ]} /" )
76+ for version in response_versions ["results" ]
77+ ]
78+ except Exception :
79+ logger .warning (
80+ "An error occurred when hitting API to fetch active versions. Defaulting to an empty list." ,
81+ exc_info = True ,
82+ )
83+ versions = []
7984
8085 # Project downloads. What are they?
8186 downloads = []
You can’t perform that action at this time.
0 commit comments