Skip to content

Commit 6287c4c

Browse files
authored
Merge pull request #27886 from dstansby/devdocs-version-switcher
Fix devdocs version switcher
2 parents 3e339a6 + 4c15ee1 commit 6287c4c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

doc/conf.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@
3636

3737
# are we running circle CI?
3838
CIRCLECI = 'CIRCLECI' in os.environ
39+
# are we deploying this build to matplotlib.org/devdocs?
40+
# This is a copy of the logic in .circleci/deploy-docs.sh
41+
DEVDOCS = (
42+
CIRCLECI and
43+
(os.environ.get("CIRCLE_PROJECT_USERNAME") == "matplotlib") and
44+
(os.environ.get("CIRCLE_BRANCH") == "main") and
45+
(not os.environ.get("CIRCLE_PULL_REQUEST", "").startswith(
46+
"https://github.com/matplotlib/matplotlib/pull")))
3947

4048

4149
def _parse_skip_subdirs_file():
@@ -489,7 +497,7 @@ def js_tag_with_cache_busting(js):
489497
"https://output.circle-artifacts.com/output/job/"
490498
f"{os.environ['CIRCLE_WORKFLOW_JOB_ID']}/artifacts/"
491499
f"{os.environ['CIRCLE_NODE_INDEX']}"
492-
"/doc/build/html/_static/switcher.json" if CIRCLECI else
500+
"/doc/build/html/_static/switcher.json" if CIRCLECI and not DEVDOCS else
493501
f"https://matplotlib.org/devdocs/_static/switcher.json?{SHA}"
494502
),
495503
"version_match": (

0 commit comments

Comments
 (0)